Compare commits

..

8 Commits

Author SHA1 Message Date
Manika Malhotra
c47aadb714 feat(frontend): adopt reworked @signozhq/ui components across remaining areas (#13087)
Some checks are pending
build-staging / prepare (push) Waiting to run
build-staging / js-build (push) Blocked by required conditions
build-staging / go-build (push) Blocked by required conditions
build-staging / staging (push) Blocked by required conditions
cacheci / tests (push) Waiting to run
Release Drafter / update_release_draft (push) Waiting to run
#### Summary

> You can see the sbshot diff at:
https://pr-docs.viniciusl.com.br/signoz-v3-pr13087-1118

Closes https://github.com/SigNoz/uforge-pod/issues/6284

This PR moves the rest of the app onto the reworked SigNoz UI library
(0.4.0-rc.4) and the new design tokens. Inputs, selects, dialogs,
drawers, popovers, toasts and text now all come from the library, so a
later design change happens in one place instead of in overrides on each
page.

Pages should look and work as they do on main. If something looks
different and is not mentioned below, treat it as a bug.

#### What looks different

Text now uses Inter from the design tokens, so numbers and a few letters
look slightly different, and monospace text uses the system code font.
Truncated text shows its full value on hover. Error toasts stay on
screen until you dismiss them.

A few flows changed on purpose. Saving or renaming a view opens a dialog
instead of a small popover. The Kubernetes entity drawer has a
breadcrumb, so you can go back to the entity you came from.

#### How to review

The commits are grouped by area and named after the pod that owns it,
such as pulse-dashboards or events-traces, so each team can review only
its part. Shared components, the query builder and styles come first,
and the tests sit in the last three commits. Only the final commit
builds, because the library upgrade breaks every page at once.

On your pages, the things most likely to be off are field heights,
spacing, text that now wraps or truncates, and popups opened from inside
a drawer or dialog. Most pages have Storybook stories from #13493, which
this PR is stacked on.

#### What changed in the components

Each block below shows one component, with a before and after taken from
this PR.

<details>
<summary>Typography</summary>

Typography is now a single component. Instead of choosing between Text
and Title, you pick a variant (paragraph, label, uppercase or code), a
size and a weight. Capitals only come from the uppercase variant, and
"muted" is now "secondary". Text cut with an ellipsis shows the full
value in a tooltip.

```diff
- <Typography.Text className="total"> of {total}</Typography.Text>
+ <Typography variant="paragraph" size="base" weight="regular" color="inherit" as="span" textOverflow="wrap">
+   of {total}
+ </Typography>
```

</details>

<details>
<summary>Dialog and AlertDialog</summary>

Dialogs take a single close callback instead of an open-change handler,
and footers are split into a left and a right slot. Confirmations moved
from ConfirmDialog to AlertDialog. Library dialogs now sit above antd
modals.

```diff
- <ConfirmDialog
-   onOpenChange={(next): void => {
-     if (!next) {
-       handleDiscardCancel();
-     }
-   }}
-   confirmColor="danger"
+ <AlertDialog
+   color="danger"
```

</details>

<details>
<summary>Drawer</summary>

Drawers close the same way as dialogs. A drawer has to say whether it
blocks the page (a task) or sits beside it (an inspector), and how it
stacks over other drawers. A drawer can also show a breadcrumb trail,
which the Kubernetes entity drawer uses to step back.

```diff
- <DrawerWrapper
-   onOpenChange={(isOpen): void => {
-     if (!isOpen) {
-       onClose();
-     }
-   }}
+ <Drawer
+   type="task"
+   stack="overlay"
+   closePosition="start"
+   trail={trail}
+   onTrailSelect={handleTrailSelect}
+   onClose={onClose}
```

</details>

<details>
<summary>Popover</summary>

Popovers take their trigger as a prop instead of being assembled from
parts. The content unmounts when the popover closes.

```diff
- <Popover>
-   <PopoverTrigger asChild>{button}</PopoverTrigger>
-   <PopoverContent align="end">{content}</PopoverContent>
- </Popover>
+ <Popover nativeButton side="bottom" align="end" trigger={button}>
+   {content}
+ </Popover>
```

</details>

<details>
<summary>Input</summary>

Inputs no longer take a container class name. Wrap them, or use the
width and size props. The test id and data attributes now sit on the
outer frame, and the input element gets the same id with a "-field"
suffix. Number inputs use Input.Number, which hands back a number or
null, so the string parsing at call sites is gone.

```diff
- <Input
-   testId="panel-type-search"
-   containerClassName={styles.search}
- />
+ <div className={styles.search}>
+   <Input testId="panel-type-search" />
+ </div>
```

</details>

<details>
<summary>Select and Combobox</summary>

SelectSimple and ComboboxSimple are now Select and Combobox. They size
with a width prop instead of a class name, and take a placeholder. The
roles picker moved from antd Select to Combobox.

```diff
- <SelectSimple
-   className={styles.filtersBarSource}
+ <Select
+   width={160}
+   placeholder="Filter by source"
```

</details>

<details>
<summary>Toast</summary>

Toasts come from the library toast module. An error toast is now called
danger, and it needs an action because it stays until dismissed.

```diff
- toast.error('Failed to copy link');
+ toast.danger('Failed to copy link', { action: { label: 'Dismiss' } });
```

</details>

<details>
<summary>Callout</summary>

Callouts use color names (primary, danger, warning), take their text as
children and render links with Callout.Link.

```diff
- <Callout type="info" showIcon title="Store the key securely." />
+ <Callout color="primary" size="sm" icon={<SolidInfoCircle />}>
+   Store the key securely.
+ </Callout>
```

</details>

<details>
<summary>AlertStrip</summary>

The no-auth banner moved from our own persisted banner to the library
AlertStrip, which remembers when it was closed.

```diff
- <PersistedAnnouncementBanner type="warning" className={styles.banner}>
-   <a href={docsLink} rel="noreferrer">
+ <AlertStrip.CloseablePersisted color="warning" side={bottomSlot ? 'bottom' : 'top'}>
+   <AlertStrip.Link href={docsLink}>
```

</details>

<details>
<summary>Resizable</summary>

Resizable takes its panes as an items array instead of panel and handle
parts, and saves the layout under a storage key.

```diff
- <ResizablePanelGroup id="panel-editor-v2">
-   <ResizablePanel minSize="75%" maxSize="80%" defaultSize="80%">
+ <Resizable
+   orientation="horizontal"
+   storageKey="panel-editor-v2"
+   storage={layoutStorage}
+   items={[{ value: 'main', label: 'Preview and editor', minSize: '75%', maxSize: '80%' }]}
```

</details>

<details>
<summary>Breadcrumb</summary>

Breadcrumb takes an items array instead of list, item, link and
separator parts.

```diff
- <Breadcrumb>
-   <BreadcrumbList>
-     <BreadcrumbItem>
-       <BreadcrumbLink icon={<LayoutGrid size={14} />} href={dashboardPageLink}>
+ <Breadcrumb
+   testId="dashboard-page-breadcrumb"
+   items={[
+     { title: 'Dashboard', icon: <LayoutGrid size={14} />, href: dashboardPageLink },
+     { title },
+   ]}
+ />
```

</details>

<details>
<summary>Kbd</summary>

Kbd takes the key name as a value, and named keys render as glyphs
(Escape shows ⎋).

```diff
- <Kbd>Esc</Kbd>
+ <Kbd value="Escape" testId="pie-tooltip-escape-key" />
```

</details>

<details>
<summary>Smaller changes</summary>

Tabs and Toaster no longer accept a class name, so the styles moved to a
wrapper. Avatar needs a name, which it uses for the initials. List
headers show their count in a Badge, with a Skeleton while the count
loads.

</details>

#### Patterns in the code

<details>
<summary>Details</summary>

Most of the diff is text styling. About 2,500 font declarations left the
SCSS files. They were replaced by Typography props or, where a
stylesheet still needs them, by the new text-style tokens described in
the CSS modules guide. The old font size, weight and line height tokens
no longer exist in design tokens 2.7.0, and the legacy card background
is now surface-2.

```diff
- font-size: var(--font-size-sm);
- font-weight: var(--font-weight-normal);
+ font-size: var(--paragraph-base-400-font-size);
```

Tests find inputs through the "-field" id. They pick combobox options by
typing in the search box and pressing Enter, since jsdom cannot click
the new options. The e2e drivers have shared helpers for inputs,
comboboxes and toasts, described in tests/e2e/AGENTS.md.

```diff
- await user.click(await screen.findByLabelText('Roles'));
- await user.click(await screen.findByTitle('signoz-editor'));
+ await user.click(await screen.findByTestId('member-roles-select'));
+ await user.type(
+   await screen.findByTestId('member-roles-select-search'),
+   `${managedRoles[1].name}{Enter}`,
+ );
```

</details>

#### New lint rules

Text style now belongs to Typography, and two rules keep it there. Both
warn for now, because about 2,700 font declarations remain in SCSS.

- signoz/no-text-css (oxlint) flags font and text properties in style
props, CSSProperties objects and styled-components.
- Stylelint flags the same properties in SCSS.

You can disable either rule where Typography cannot render the text,
such as canvas or chart labels. The disable must say why after "--", or
it fails as an error.

<details>
<summary>Example</summary>

```tsx
// oxlint-disable-next-line signoz/no-text-css -- canvas text, not DOM
ctx.font = '12px Inter';
```

```scss
/* stylelint-disable-next-line property-disallowed-list -- antd table header, no Typography slot */
font-weight: 500;
```

</details>

---------

Co-authored-by: Vinícius Lourenço <vinicius@signoz.io>
2026-11-20 19:42:44 +05:30
Vinicius Lourenço
d317275b36 test(storybook): cover the states the component migration changes (#13493)
#### Description

This PR adds the stories we wrote while migrating to the new version of
`@signozhq/ui` (#13087), but running against the components we have on
main today.

I'm splitting them out so the screenshot diff of the migration has a
"before" for every story. Without this, the new stories only exist on
the migration branch and there is nothing to compare them with.

They cover the states the migration touches: open selects, dialogs,
drawers and popovers, more toast variants, the command palette, the
license and trial banners, the K8s drawer opened a few levels deep, SSO
attribute mapping and the query builder add-ons. A few existing plays
also moved into their `*.play.ts` files. No app code changes, only
stories and the mocks they need.

#### Screenshots / Screen Recordings

Every new story, in dark and light:
https://claude.ai/artifact/TeBTXRkB9puh7W6LnGXFQ8

#### Additional Information

#13087 sits on top of this one, so its diff only shows the migration.

---------

Co-authored-by: Manika Malhotra <manika@signoz.io>
2026-11-20 19:41:57 +05:30
Vikrant Gupta
61bc6698d1 feat(serviceaccount): paginate and filter the list endpoint (#13545)
#### Description

- `GET /api/v1/service_accounts` returns a page (`serviceAccounts`,
`total`, `reservedKeywords`) with `limit`, `offset`, `sort` and `order`.
- `query` is a SigNoz filter expression over `name`, `email`, `status`,
`created_at` and `updated_at`; a bare token matches name or email.

#### Issues Closed by this PR

Closes: https://github.com/SigNoz/keystone-pod/issues/221

---------

Co-authored-by: hardik-signoz <hardik.saini@signoz.io>
2026-11-20 11:59:55 +00:00
Ashwin Bhatkal
518def70e0 feat(infra-monitoring): keep filters when switching kubernetes resources (#13406)
#### Description

- Switching resources under "Viewing · Resource" no longer clears the
filter. Clauses the new resource can filter by are kept and the rest are
dropped, the same rule the drawer already uses, so the quick filter
checkboxes stay in step.
- The drawer's locked filter shows every clause instead of the last one
plus a `+N` count, so the scope reads without hovering. The existing
"Infra monitoring/Drawer overview tab" story already renders this state.
- Switching resources no longer changes what a filter means. A filter
with an OR, or a NOT over a group, is not carried at all, because no
subset of its clauses means the same thing. A clause with a leading NOT
is left out and the rest are carried. Before, `a = 1 OR b = 2` arrived
as `a = 1 AND b = 2`, and `NOT a = 1` arrived as `a = 1`.
- Stacked on #13405, which fixes the clause cutting this relies on.

#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/535
2026-11-20 11:44:40 +00:00
Aditya Singh
164ff1faec fix(messaging-queues): move the Kafka and Celery pages to query_range v5 (#13644)
#### Description

- The Kafka and Celery messaging queue pages load their graphs, tiles
and drawer tables with the v3 and v4 `query_range` APIs. The backend
plans to remove those APIs.
- The pages now load from v5 `query_range` and show the same data. The
Kafka group, topic and partition dropdowns read `/api/v1/fields/values`
instead of the v3 autocomplete.
- Chart clicks did nothing on the Kafka Consumer Lag graph, the Celery
state bars, the worker graphs and the Overview drawer graphs. The new
time series and bar panels dropped the page's own click handler. The
panels call it again when drilldown is off.
- The Drop Rate view is removed. It read the legacy `span/evaluation`
endpoint.

#### Issues closed by this PR

Closes https://github.com/SigNoz/events-pod/issues/157

#### Screenshots / Screen Recordings

Main vs this branch, diff view:
https://claude.ai/artifact/BpiYPvdSVXPAD7goQdfVhh

| Screen | On `main` | On this branch |
| --- | --- | --- |
| Kafka overview (3 stories) | Five view cards, including Drop Rate View
| Four view cards. Drop Rate View is gone. |
| Celery task (Default, Failing Tasks, Failed Tasks Only, No Flower
Metrics) | Error% by worker draws a single point on a 0–2000% axis |
Error% by worker draws one line per worker (30–80%) |
| Celery task, State Drawer (new story) | Not reachable. A chart click
does nothing on `main`. | A click on the All state graph opens the
drawer with the slowest tasks for that state |

- Each side is a static Storybook build, shot in dark and light. The
`main` side uses its own v3/v4 story mocks.
- 14 pairs changed and 20 are pixel-identical (Kafka Detail and the
queue Overview).
- The Error% difference comes partly from the mocks: on `main`, the
story's v4 mock answers the formula as a single point.

#### Additional Information

- Part of https://github.com/SigNoz/events-pod/issues/156.
- Stories serve v5. A new `StateDrawer` play opens the Celery drawer
from a chart click. The Kafka detail state is already covered by the
story's `selected` arg.

**FAQ (v4/v3 → v5)**

**Celery traces queries carry `aggregations: [{ expression }]`**
v5 builds a traces aggregation only from the expression. Without it,
`aggregateOperator` is ignored and the query becomes `count()`.

**Celery queries order by `p99(duration_nano)`, not `#SIGNOZ_VALUE`**
`#SIGNOZ_VALUE` was a v4 alias for the value column, and v5 rejects it.
The order key has to name the aggregation expression. This affects the
latency tabs and the drawer tables.

**Grouped Celery queries filter on `<key> exists`**
_Where:_ Messaging Queues › Celery › All state graph and Task Latency
v4 dropped spans that lack the group-by key. v5 returns them as an extra
group with an empty label, which shows as a blank bar on All and an
extra line on Task Latency. API Monitoring got the same fix (`http_url
exists`).

**Kafka metrics graphs send no step**
_Where:_ Messaging Queues › Kafka › Metric view, on ranges over 5 hours
v5 clamps a metrics step to at least range/300, with a 60s floor. A
fixed 60s on a 1-week range shows "requesting aggregation interval 60
seconds…". Sending no step lets v5 pick one. Service details (#13617)
does the same.

**Celery formulas moved to `queryFormulas`**
_Where:_ Messaging Queues › Celery › Error% by worker; Messaging Queues
› Overview › row drawer › Error %
v4 took them inside `builderQueries`. The v5 payload builder reads
formulas only from `queryFormulas`, so in the old place they went out as
metrics builder queries.

**State tiles show bigger numbers**
_Where:_ Messaging Queues › Celery › All Tasks / Failed / Retry /
Successful; Messaging Queues › Overview › row drawer tiles
v4 value panels showed one bucket of a time series (the last minute). v5
scalar requests aggregate the whole window. The numbers match ClickHouse
for the selected range.

**Graphs show the most recent data**
_Where:_ Messaging Queues › Celery › the last bar or point of each graph
v4 traces queries rounded the end down to a whole step, which dropped up
to one step of recent data. v5 keeps the partial bucket.

**Kafka group/topic/partition dropdowns call `/fields/values`**
_Where:_ Messaging Queues › Kafka › Consumer Lag view › group / topic /
partition selects
They used the v3 autocomplete endpoint. `/fields/values` takes the
metric name and filters `searchText` on the server.

**Chart clicks call the page's handler again**
_Where:_ Messaging Queues › Kafka › Consumer Lag graph; Messaging Queues
› Celery › state bars and worker graphs; Messaging Queues › Overview ›
row drawer graphs
When the panels moved to the new time series and bar panels, a page's
own `onClickHandler` stopped being called with drilldown off. The Kafka
lag graph, the Celery state bars and the Overview drawer graphs ignored
clicks. The handler is called again from `usePanelContextMenu`, so API
Monitoring endpoint graphs get their View Traces click back too. A click
outside a series no longer opens a Celery drawer.

**Drop Rate removed**
_Where:_ Messaging Queues › Kafka › view cards and the view selector
Agreed with Pandey to remove it rather than port it. It read the legacy
`span/evaluation` endpoint, which the backend serves only behind the
experimental `kafka_span_eval` flag. The flag is off by default, so the
view returned an error unless `KAFKA_SPAN_EVAL=true` was set. Old
`?mqServiceView=dropRate` links open Consumer Lag.

**Warning icon on empty metric graphs**
_Where:_ Messaging Queues › Kafka › Metric view
v5 reports a metric that was never ingested, and the graph shows that.

Issues found on `main` while testing are filed in
https://github.com/SigNoz/events-pod/issues/280. The ones this PR fixes
are ticked there.
2026-11-20 11:15:24 +00:00
Ashwin Bhatkal
f6f7144a80 fix(infra-monitoring): keep list filter clauses whole when carried into the drawer (#13405)
#### Description

- Opening a pod or container from a list filtered by a quick filter
broke the drawer's overview tab. A list filter like `k8s.cluster.name in
['cluster-a']` arrived in the drawer as `k8s.cluster.name in
['cluster-a'`, which does not parse.
- Each carried clause is now cut from its key to the end of its value,
which for `in [...]` is the closing bracket.
- The same cut also dropped the key from a `NOT IN` clause, and pulled
every dropped clause in front of a kept one into the result. Both are
fixed and covered in `relations.test.ts`.

#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/756
2026-11-20 10:28:30 +00:00
Naman Verma
73f02c25e7 feat(rules): report threshold names in the v3 list api (#13606)
<!--A few plain bullets saying what changed and why, for a reviewer
skimming it - not a wall of text, not a restatement of the diff, not
generated boilerplate.-->
#### Description

A rule's alerts carry the lowercased name of the threshold that fired as
their severity; the rule's own `severity` label is a plain label since
#13612. The v3 list row's new `thresholds` field reports exactly that:
each distinct threshold name, ranked critical, error, warning, info,
then the rest.

<!--Reference issues using `Closes #issue-number` to enable automatic
closure on merge. -->
#### Issues closed by this PR

Closes https://github.com/SigNoz/pulse-pod/issues/653

---------

Co-authored-by: Ashu Ghildiyal <ashu.ghildiyal@signoz.io>
2026-11-20 09:46:00 +00:00
Nityananda Gohain
a01cc1aef9 fix(llm-observability): mirror the collector's bounded prefix match for pricing patterns (#13334)
#### Description

- `ModelMatchesAnyRule` and pattern validation now call the collector's
`pkg/llmpricing` (SigNoz/signoz-otel-collector#973) instead of a copied
regex, so a pattern matches the model exactly or followed by snapshot
suffixes (`-20260921`, `-latest`, `-v2:0`, `@20260921`), and a trailing
`*` matches
  any suffix. Priced snapshots no longer show up as unmapped.
- Validation rejects a non-trailing `*`, surrounding whitespace and
control characters; other glob characters are literal in the collector
now, so rejecting them was wrong.
- `PatternEditor` shows the stored pattern instead of appending a
cosmetic `*`, and the help text describes the actual matching.
  - Companion to SigNoz/zeus#606 for nerve-pod#517.

  #### Issues closed by this PR

  Closes https://github.com/SigNoz/nerve-pod/issues/517

#### Screenshots
Before:
<img width="541" height="531" alt="image"
src="https://github.com/user-attachments/assets/2a0cde21-ab05-40c2-be25-2a759ac01426"
/>

After:

<img width="541" height="531" alt="image"
src="https://github.com/user-attachments/assets/a50d8a62-1096-4c89-9871-019d9f6cb26d"
/>




  #### Additional Information

- `signoz-otel-collector` is pinned to `v0.144.17-rc.1`, the first tag
with `pkg/llmpricing`; bump to `v0.144.17` once it's released.
- No story change: the `ModelCostDrawer` story already renders the
pattern chips.
- Rules saved with glob syntax keep working as literal patterns,
matching the collector.

---------

Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
2026-11-20 08:52:27 +00:00
1571 changed files with 28890 additions and 20376 deletions

View File

@@ -11882,7 +11882,7 @@ components:
- created_at
- name
- state
- severity
- thresholds
type: string
RuletypesListableRule:
properties:
@@ -11922,6 +11922,13 @@ components:
- $ref: '#/components/schemas/RuletypesAlertState'
description: 'The current evaluation state: inactive, pending, recovering,
firing, nodata or disabled.'
thresholds:
description: The rule's threshold names in lowercase, deduplicated and ordered
critical, error, warning, info, then other names. An alert carries the
name of the threshold that fired as its severity. Read-only.
items:
type: string
type: array
updatedAt:
format: date-time
type: string
@@ -11933,6 +11940,7 @@ components:
- alert
- alertType
- ruleType
- thresholds
type: object
RuletypesListableRuleViews:
properties:
@@ -12299,7 +12307,8 @@ components:
allOf:
- $ref: '#/components/schemas/RuletypesListSort'
description: 'The field to sort by: updated_at (the default), created_at,
name, state or severity.'
name, state or thresholds. Sorting by thresholds ranks each rule by its
first threshold name.'
states:
description: 'Only return rules in these states: firing, pending, recovering,
inactive, nodata or disabled. Empty means every state.'
@@ -12513,6 +12522,14 @@ components:
- schemaVersion
- spec
type: object
ServiceaccounttypesDSLKey:
enum:
- created_at
- email
- name
- status
- updated_at
type: string
ServiceaccounttypesGettableFactorAPIKey:
properties:
createdAt:
@@ -12549,6 +12566,28 @@ components:
- id
- key
type: object
ServiceaccounttypesListableServiceAccount:
properties:
reservedKeywords:
description: The filter keys the query accepts.
items:
$ref: '#/components/schemas/ServiceaccounttypesDSLKey'
type: array
serviceAccounts:
description: The service accounts on this page.
items:
$ref: '#/components/schemas/ServiceaccounttypesServiceAccount'
type: array
total:
description: The number of service accounts the filter matches across all
pages.
format: int64
type: integer
required:
- serviceAccounts
- total
- reservedKeywords
type: object
ServiceaccounttypesPostableFactorAPIKey:
properties:
expiresAt:
@@ -12591,17 +12630,30 @@ components:
orgId:
type: string
status:
type: string
$ref: '#/components/schemas/ServiceaccounttypesServiceAccountStatus'
updatedAt:
format: date-time
type: string
required:
- id
- createdAt
- updatedAt
- name
- email
- status
- orgId
type: object
ServiceaccounttypesServiceAccountListOrder:
enum:
- asc
- desc
type: string
ServiceaccounttypesServiceAccountListSort:
enum:
- created_at
- updated_at
- name
type: string
ServiceaccounttypesServiceAccountRole:
properties:
createdAt:
@@ -12624,6 +12676,11 @@ components:
- roleId
- role
type: object
ServiceaccounttypesServiceAccountStatus:
enum:
- active
- deleted
type: string
ServiceaccounttypesServiceAccountWithRoles:
properties:
createdAt:
@@ -12643,12 +12700,14 @@ components:
nullable: true
type: array
status:
type: string
$ref: '#/components/schemas/ServiceaccounttypesServiceAccountStatus'
updatedAt:
format: date-time
type: string
required:
- id
- createdAt
- updatedAt
- name
- email
- status
@@ -17744,8 +17803,56 @@ paths:
/api/v1/service_accounts:
get:
deprecated: false
description: This endpoint lists the service accounts for an organisation
description: Returns a page of the service accounts for an organisation. `query`
is a filter expression over name, email, status, created_at and updated_at,
for example `status = 'active'`; `sort`/`order` pick the ordering and `limit`/`offset`
the page.
operationId: ListServiceAccounts
parameters:
- description: 'A filter expression over the reserved keys name, email, status,
created_at and updated_at using the SigNoz filter grammar: comparisons such
as =, !=, CONTAINS, LIKE, IN, < and >, single-quoted strings, RFC3339 timestamps
in quotes for created_at and updated_at, combined with AND, OR and NOT,
for example name CONTAINS ''ci'' AND status = ''active''. A bare or quoted
token without a key matches name or email case-insensitively. At most 1024
characters. Empty matches every service account.'
in: query
name: query
schema:
description: 'A filter expression over the reserved keys name, email, status,
created_at and updated_at using the SigNoz filter grammar: comparisons
such as =, !=, CONTAINS, LIKE, IN, < and >, single-quoted strings, RFC3339
timestamps in quotes for created_at and updated_at, combined with AND,
OR and NOT, for example name CONTAINS ''ci'' AND status = ''active''.
A bare or quoted token without a key matches name or email case-insensitively.
At most 1024 characters. Empty matches every service account.'
type: string
- description: 'The sort column: created_at (default), updated_at or name.'
in: query
name: sort
schema:
allOf:
- $ref: '#/components/schemas/ServiceaccounttypesServiceAccountListSort'
description: 'The sort column: created_at (default), updated_at or name.'
- description: 'The sort order: asc or desc (default).'
in: query
name: order
schema:
allOf:
- $ref: '#/components/schemas/ServiceaccounttypesServiceAccountListOrder'
description: 'The sort order: asc or desc (default).'
- description: The page size; defaults to 20 and is capped at 200.
in: query
name: limit
schema:
description: The page size; defaults to 20 and is capped at 200.
type: integer
- description: The number of service accounts to skip; defaults to 0.
in: query
name: offset
schema:
description: The number of service accounts to skip; defaults to 0.
type: integer
responses:
"200":
content:
@@ -17753,9 +17860,7 @@ paths:
schema:
properties:
data:
items:
$ref: '#/components/schemas/ServiceaccounttypesServiceAccount'
type: array
$ref: '#/components/schemas/ServiceaccounttypesListableServiceAccount'
status:
type: string
required:
@@ -17763,6 +17868,12 @@ paths:
- data
type: object
description: OK
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/RenderErrorResponse'
description: Bad Request
"401":
content:
application/json:
@@ -32094,7 +32205,7 @@ paths:
deprecated: false
description: Returns a page of alert rules with their current evaluation state,
trimmed to the fields the list page renders. Supports a filter DSL (`query`),
a repeated `states` filter applied after the state overlay, sort (`updated_at`/`created_at`/`name`/`state`/`severity`),
a repeated `states` filter applied after the state overlay, sort (`updated_at`/`created_at`/`name`/`state`/`thresholds`),
order (`asc`/`desc`), and offset-based pagination (`limit`/`offset`). In the
filter DSL, a non-reserved key is matched as a rule label directly (`team
= infra`); a key that collides with a reserved keyword matches either interpretation
@@ -32122,14 +32233,16 @@ paths:
type: string
type: array
- description: 'The field to sort by: updated_at (the default), created_at,
name, state or severity.'
name, state or thresholds. Sorting by thresholds ranks each rule by its
first threshold name.'
in: query
name: sort
schema:
allOf:
- $ref: '#/components/schemas/RuletypesListSort'
description: 'The field to sort by: updated_at (the default), created_at,
name, state or severity.'
name, state or thresholds. Sorting by thresholds ranks each rule by its
first threshold name.'
- description: 'The sort direction: asc or desc (the default).'
in: query
name: order

View File

@@ -52,7 +52,7 @@ func (f *formatter) JSONIsArray(column, path string) []byte {
func (f *formatter) JSONArrayElements(column, path, alias string) ([]byte, []byte) {
var sql []byte
sql = append(sql, "jsonb_array_elements("...)
sql = f.bunf.AppendIdent(sql, column)
sql = append(sql, f.TextToJsonColumn(column)...)
sql = append(sql, f.convertJSONPathToPostgresWithMode(path, false)...)
sql = append(sql, ") AS "...)
sql = f.bunf.AppendIdent(sql, alias)

View File

@@ -213,28 +213,28 @@ func TestJSONArrayElements(t *testing.T) {
column: "data",
path: "$",
alias: "elem",
expected: `jsonb_array_elements("data") AS "elem"`,
expected: `jsonb_array_elements("data"::jsonb) AS "elem"`,
},
{
name: "root path empty",
column: "data",
path: "",
alias: "elem",
expected: `jsonb_array_elements("data") AS "elem"`,
expected: `jsonb_array_elements("data"::jsonb) AS "elem"`,
},
{
name: "nested path",
column: "metadata",
path: "$.items",
alias: "item",
expected: `jsonb_array_elements("metadata"->'items') AS "item"`,
expected: `jsonb_array_elements("metadata"::jsonb->'items') AS "item"`,
},
{
name: "deeply nested path",
column: "json_col",
path: "$.user.tags",
alias: "tag",
expected: `jsonb_array_elements("json_col"->'user'->'tags') AS "tag"`,
expected: `jsonb_array_elements("json_col"::jsonb->'user'->'tags') AS "tag"`,
},
}

View File

@@ -8,5 +8,5 @@
.title {
color: var(--l1-foreground);
font-size: var(--font-size-lg);
font-size: var(--label-large-400-font-size);
}

View File

@@ -497,7 +497,11 @@
// Requires final else in if-else-if chains (was disabled)
"signoz/no-conditional-text-nodes-with-siblings": "warn",
// Vendored from eslint-plugin-react-google-translate
"signoz/no-return-text-nodes": "warn"
"signoz/no-return-text-nodes": "warn",
"signoz/no-text-css": "warn",
// Font and text CSS in style props, CSSProperties objects and styled-components; text style goes through Typography props
"signoz/require-disable-reason": "error"
// A disable of signoz/no-text-css must say why Typography cannot render the text
},
"ignorePatterns": [
"src/parser/*.ts",

View File

@@ -40,8 +40,8 @@ const mockAliases = [
},
{
// jest: not replaced, a test asserts on the toast it fires.
find: /^@signozhq\/ui\/sonner$/,
replacement: `${srcPath}/storybook/mocks/sonner.mock.tsx`,
find: /^@signozhq\/ui\/toast$/,
replacement: `${srcPath}/storybook/mocks/toast.mock.tsx`,
},
];

View File

@@ -1,8 +1,6 @@
<!--
`index.html` links Inter from Google Fonts here. The link is parsed before the
msw worker has started, so that one request escapes the iframe while every
other font request the app makes is answered with an empty stylesheet; the
local faces stand in for both.
Every Google Fonts request the app makes is answered with an empty
stylesheet; the local faces stand in for them.
-->
<link rel="stylesheet" href="storybook-fonts.css" />

View File

@@ -1,22 +1,11 @@
/*
* The five families the app pulls from Google Fonts, served from the files in
* The three families the app pulls from Google Fonts, served from the files in
* `public/fonts` instead. `msw/appShellHandlers.ts` answers the CDN with an
* empty stylesheet so no request leaves the iframe, which without this left
* every story on a fallback for the four families `src/styles.scss` imports at
* runtime, and on whatever the Inter link in `index.html` happened to fetch
* before the worker had started.
* every story on a fallback for the three families `src/styles.scss` imports at
* runtime. Inter and Geist Mono come from `src/styles.scss` itself.
*/
@font-face {
font-family: 'Inter';
/* The comma is part of the filename and the dev server serves it raw, so it
stays literal inside the quoted url rather than percent-encoded. */
src: url('fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
font-weight: 100 900;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Work Sans';
src: url('fonts/WorkSans-VariableFont_wght.ttf') format('truetype');
@@ -40,11 +29,3 @@
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Geist Mono';
src: url('fonts/GeistMonoVF.woff2') format('woff2');
font-weight: 100 900;
font-style: normal;
font-display: swap;
}

View File

@@ -14,9 +14,23 @@ module.exports = {
path.join(__dirname, 'stylelint-rules/css-modules/class-name-pattern.js'),
],
customSyntax: 'postcss-scss',
// Disables of property-disallowed-list must say why after "--"
reportDescriptionlessDisables: [
false,
{ except: ['property-disallowed-list'], severity: 'error' },
],
rules: {
// Applies to all SCSS files
'local/no-unsupported-asset-url': true,
// Text style goes through @signozhq/ui/typography props
'property-disallowed-list': [
['/^font/', '/^text-/', 'line-height', 'letter-spacing'],
{
severity: 'warning',
message: (property) =>
`Do not set "${property}" in CSS. Render the text with @signozhq/ui/typography and use its props, or disable this rule with a reason after "--" saying why Typography cannot.`,
},
],
},
overrides: [
{

View File

@@ -191,34 +191,30 @@ You can read the ./node_modules/@signozhq/design-tokens/dist/style.css to find c
### Typography
Text styles are tokens named `--{variant}-{size}-{weight}-{property}`:
- Variant: `label` (line height 1), `paragraph` (line height 18, 20 or 26px), `uppercase` (11 and 13px) or `code` (SF Mono, 11 and 13px).
- Size: `small` (11px), `base` (13px), `medium` (16px) or `large` (18px). Paragraph has no `large`; uppercase and code have only `small` and `base`.
- Weight: `400`, `500` or `600`.
- Property: `font-family`, `font-size`, `font-weight`, `line-height`, `letter-spacing` or `text-transform`.
```scss
// Font sizes (preferred)
.title {
font-size: var(--periscope-font-size-large); // 18px
font-size: var(--periscope-font-size-medium); // 16px
font-size: var(--periscope-font-size-base); // 13px
font-size: var(--periscope-font-size-small); // 11px
font-family: var(--label-large-500-font-family);
font-size: var(--label-large-500-font-size);
font-weight: var(--label-large-500-font-weight);
line-height: var(--label-large-500-line-height);
letter-spacing: var(--label-large-500-letter-spacing);
}
// Alternative scale (rem-based)
.heading {
font-size: var(--font-size-xl); // 1.25rem
font-size: var(--font-size-lg); // 1.125rem
font-size: var(--font-size-base); // 1rem
font-size: var(--font-size-sm); // 0.875rem
.hint {
font-size: var(--paragraph-small-400-font-size); // 11px
line-height: var(--paragraph-small-400-line-height); // 18px
}
// Font weights
.bold {
font-weight: var(--font-weight-semibold); // 600
font-weight: var(--font-weight-medium); // 500
font-weight: var(--font-weight-normal); // 400
}
// Line heights
.text {
line-height: var(--line-height-20); // 20px
line-height: var(--line-height-24); // 24px
.id {
font-family: var(--code-base-400-font-family);
font-size: var(--code-base-400-font-size); // 13px
}
```
@@ -312,7 +308,7 @@ Each component exposes `--<component>-<property>` variables:
--button-background: var(--success-background);
--button-border-radius: var(--radius-2);
--button-padding: var(--spacing-4) var(--spacing-8);
--button-font-size: var(--periscope-font-size-base);
--button-font-size: var(--label-base-400-font-size);
}
// Override Input
@@ -342,7 +338,7 @@ Components use data attributes for variants/states. Target them for state-specif
// Target size
.wrapper :global([data-size="sm"]) {
--button-font-size: var(--periscope-font-size-small);
--button-font-size: var(--label-small-400-font-size);
}
// Target color

View File

@@ -14,11 +14,6 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="preconnect" href="https://cdn.vercel.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
rel="stylesheet"
/>
<title data-react-helmet="true">
Open source Observability platform | SigNoz
</title>

View File

@@ -54,9 +54,9 @@
"@monaco-editor/react": "^4.7.0",
"@sentry/react": "10.57.0",
"@sentry/vite-plugin": "5.3.0",
"@signozhq/design-tokens": "2.2.1",
"@signozhq/design-tokens": "2.8.0",
"@signozhq/icons": "0.4.0",
"@signozhq/ui": "0.2.0",
"@signozhq/ui": "0.4.0-rc.5",
"@tanstack/react-table": "8.21.3",
"@tanstack/react-virtual": "3.13.22",
"@uiw/codemirror-theme-copilot": "4.23.11",

View File

@@ -0,0 +1,170 @@
import { ruleTester } from './rule-tester.mjs';
const message = (property) =>
`Do not set '${property}' in CSS. Render the text with @signozhq/ui/typography and use its props, or disable this rule with a reason after \`--\` saying why Typography cannot.`;
await ruleTester({
rule: 'no-text-css',
valid: [
{
name: 'layout properties in a style prop',
code: 'export const A = () => <div style={{ width: 10, color: "red" }} />;',
},
{
name: 'font properties in an object that is not a style',
code: 'export const options = { fontSize: 12, font: "12px Inter" };',
},
{
name: 'font properties in a prop that is not a style',
code: 'export const A = () => <Chart options={{ fontSize: 12 }} />;',
},
{
name: 'computed key',
code:
'const k = "fontSize";\nexport const A = () => <div style={{ [k]: 12 }} />;',
},
{
name: 'style identifier from a parameter',
code: 'export const A = ({ s }) => <div style={s} />;',
},
{
name: 'template without a styled tag',
code: 'export const s = html`font-size: 12px;`;',
},
{
name: 'styled template with layout only',
code:
"import styled from 'styled-components';\nexport const A = styled.div`\n\tdisplay: flex;\n\ttext: none;\n`;",
},
{
name: 'custom property that ends in a banned name',
code:
"import styled from 'styled-components';\nexport const A = styled.div`\n\t--my-font-size: 12px;\n`;",
},
],
invalid: [
{
name: 'inline style',
code: 'export const A = () => <div style={{ fontSize: 12, width: 1 }} />;',
errors: [{ message: message('fontSize'), line: 1, column: 38 }],
},
{
name: 'string key',
code: "export const A = () => <div style={{ 'line-height': 1 }} />;",
errors: [{ message: message('line-height') }],
},
{
name: 'every banned family',
code:
'export const A = () => (\n\t<div\n\t\tstyle={{\n\t\t\tfont: "x",\n\t\t\tfontWeight: 500,\n\t\t\tfontFamily: "x",\n\t\t\ttextAlign: "center",\n\t\t\ttextTransform: "none",\n\t\t\tlineHeight: 1,\n\t\t\tletterSpacing: 1,\n\t\t}}\n\t/>\n);',
errors: [
{ message: message('font') },
{ message: message('fontWeight') },
{ message: message('fontFamily') },
{ message: message('textAlign') },
{ message: message('textTransform') },
{ message: message('lineHeight') },
{ message: message('letterSpacing') },
],
},
{
name: 'conditional, logical and spread',
code:
'export const A = ({ a, b }) => (\n\t<div style={{ ...(a ? { fontSize: 1 } : {}), ...(b && { lineHeight: 1 }) }} />\n);',
errors: [
{ message: message('fontSize') },
{ message: message('lineHeight') },
],
},
{
name: 'style prop with a Style suffix',
code:
'export const A = () => <Card headStyle={{ fontWeight: 600 }} bodyStyle={{ padding: 0 }} />;',
errors: [{ message: message('fontWeight') }],
},
{
name: 'antd semantic styles',
code:
'export const A = () => <Modal styles={{ body: { fontSize: 12 }, header: { padding: 0 } }} />;',
errors: [{ message: message('fontSize') }],
},
{
name: 'identifier resolved to a local object',
code:
'const s = { fontSize: 12 };\nexport const A = () => (\n\t<>\n\t\t<div style={s} />\n\t\t<span style={s} />\n\t</>\n);',
errors: [{ message: message('fontSize'), line: 1, column: 13 }],
},
{
name: 'useMemo style',
code:
"import { useMemo } from 'react';\nexport const A = () => {\n\tconst s = useMemo(() => ({ textAlign: 'left' }), []);\n\treturn <div style={s} />;\n};",
errors: [{ message: message('textAlign') }],
},
{
name: 'object typed CSSProperties',
code:
"import type { CSSProperties } from 'react';\nexport const s: CSSProperties = { fontStyle: 'italic' };",
errors: [{ message: message('fontStyle') }],
},
{
name:
'object typed React.CSSProperties, reported once when also used as style',
code:
"import React from 'react';\nconst s: React.CSSProperties = { fontSize: 1 };\nexport const A = () => <div style={s} />;",
errors: [{ message: message('fontSize') }],
},
{
name: 'Record of CSSProperties',
code:
"import type { CSSProperties } from 'react';\nexport const s: Record<string, CSSProperties> = { a: { lineHeight: 1 } };",
errors: [{ message: message('lineHeight') }],
},
{
name: 'as and satisfies CSSProperties',
code:
"import type { CSSProperties } from 'react';\nexport const a = { fontSize: 1 } as CSSProperties;\nexport const b = { fontWeight: 1 } satisfies CSSProperties;",
errors: [
{ message: message('fontSize') },
{ message: message('fontWeight') },
],
},
{
name: 'styled-components template',
code:
"import styled from 'styled-components';\nexport const A = styled.div`\n\tdisplay: flex;\n\tfont-size: 12px;\n\tcolor: ${(p) => p.c};\n\ttext-transform: none;line-height: 1;\n`;",
errors: [
{ message: message('font-size'), line: 4, column: 2 },
{ message: message('text-transform'), line: 6, column: 2 },
{ message: message('line-height'), line: 6, column: 23 },
],
},
{
name: 'function returning CSSProperties',
code:
"import type { CSSProperties } from 'react';\nexport const a = (): CSSProperties => ({ fontSize: 1 });\nexport function b(): CSSProperties {\n\treturn { lineHeight: 1 };\n}",
errors: [
{ message: message('fontSize') },
{ message: message('lineHeight') },
],
},
{
name: 'strings in styled interpolations',
code:
"import styled, { css } from 'styled-components';\nexport const A = styled.div`\n\t${(p) => (p.s ? 'font-size: 11px;' : `line-height: 1;`)}\n\t${(p) => p.b && css`font-weight: 500;`}\n`;",
errors: [
{ message: message('font-size'), line: 3, column: 19 },
{ message: message('line-height'), line: 3, column: 40 },
{ message: message('font-weight'), line: 4, column: 22 },
],
},
{
name: 'styled(Component) and css helper',
code:
"import styled, { css } from 'styled-components';\nexport const A = styled(B)`letter-spacing: 1px;`;\nexport const c = css`\n\tfont-weight: 500;\n`;",
errors: [
{ message: message('letter-spacing'), line: 2, column: 28 },
{ message: message('font-weight'), line: 4, column: 2 },
],
},
],
});

View File

@@ -0,0 +1,49 @@
import { ruleTester } from './rule-tester.mjs';
const message = 'Disabling signoz/no-text-css needs a reason after `--`.';
await ruleTester({
rule: 'require-disable-reason',
valid: [
{
name: 'reason after --',
code:
'// oxlint-disable-next-line signoz/no-text-css -- canvas label\nexport const a = 1;',
},
{
name: 'block comment with a reason',
code:
'/* eslint-disable signoz/no-text-css -- email HTML */\nexport const a = 1;',
},
{
name: 'another rule without a reason',
code: '// oxlint-disable-next-line no-console\nexport const a = 1;',
},
{
name: 'disable of every rule',
code: '// eslint-disable-next-line\nexport const a = 1;',
},
{
name: 'plain comment naming the rule',
code: '// signoz/no-text-css flags font CSS\nexport const a = 1;',
},
],
invalid: [
{
name: 'next-line without a reason',
code: '// oxlint-disable-next-line signoz/no-text-css\nexport const a = 1;',
errors: [{ message, line: 1, column: 1 }],
},
{
name: 'empty reason',
code: '// eslint-disable-line signoz/no-text-css --\nexport const a = 1;',
errors: [{ message }],
},
{
name: 'among other rules',
code:
'/* oxlint-disable no-console, signoz/no-text-css */\nexport const a = 1;',
errors: [{ message }],
},
],
});

View File

@@ -0,0 +1,324 @@
/**
* Rule: no-text-css
*
* Text style (font, line height, letter spacing, case, alignment, overflow)
* belongs to Typography props, not to CSS written in a component.
*
* This rule catches font and text properties in:
* <div style={{ fontSize: 12 }} /> style and *Style props
* <Modal styles={{ body: { fontWeight: 500 } }} />
* const s: CSSProperties = { lineHeight: 1 } objects typed CSSProperties
* ({ ... }) as CSSProperties, satisfies CSSProperties
* (): CSSProperties => ({ ... }) functions returning CSSProperties
* styled.div`font-size: 12px;` styled-components templates,
* ${(p) => p.small && 'font-size: 11px;'} strings in their interpolations
*
* Identifiers passed to a style prop are followed to a local object literal.
* SCSS is covered by the stylelint config.
*/
const MESSAGE = (property) =>
`Do not set '${property}' in CSS. Render the text with @signozhq/ui/typography and use its props, or disable this rule with a reason after \`--\` saying why Typography cannot.`;
const BANNED_JS = /^(font([A-Z]\w*)?|text[A-Z]\w*|lineHeight|letterSpacing)$/;
const BANNED_CSS =
/(^|[\s;{])(font(-[a-z]+)*|text-[a-z-]+|line-height|letter-spacing)\s*:/g;
const STYLE_TAGS = new Set(['css', 'createGlobalStyle', 'keyframes']);
const FUNCTIONS = new Set([
'ArrowFunctionExpression',
'FunctionExpression',
'FunctionDeclaration',
]);
const camelCase = (name) =>
name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
function propertyName(property) {
if (property.computed) {
return null;
}
if (property.key.type === 'Identifier') {
return property.key.name;
}
if (
property.key.type === 'Literal' &&
typeof property.key.value === 'string'
) {
return property.key.value;
}
return null;
}
function isCssPropertiesType(typeNode) {
if (!typeNode || typeNode.type !== 'TSTypeReference') {
return false;
}
const name = typeNode.typeName;
if (name.type === 'Identifier') {
return name.name === 'CSSProperties';
}
return name.type === 'TSQualifiedName' && name.right.name === 'CSSProperties';
}
// Record<K, CSSProperties> and { [key: string]: CSSProperties }
function isCssPropertiesMapType(typeNode) {
if (!typeNode) {
return false;
}
if (
typeNode.type === 'TSTypeReference' &&
typeNode.typeName.type === 'Identifier' &&
typeNode.typeName.name === 'Record'
) {
const params = (typeNode.typeArguments ?? typeNode.typeParameters)?.params;
return isCssPropertiesType(params?.[1]);
}
if (typeNode.type === 'TSTypeLiteral') {
return typeNode.members.some(
(member) =>
member.type === 'TSIndexSignature' &&
isCssPropertiesType(member.typeAnnotation?.typeAnnotation),
);
}
return false;
}
function rootIdentifier(node) {
let current = node;
while (current) {
if (current.type === 'Identifier') {
return current.name;
}
if (current.type === 'MemberExpression') {
current = current.object;
} else if (current.type === 'CallExpression') {
current = current.callee;
} else {
return null;
}
}
return null;
}
function isStyleTag(tag) {
if (tag.type === 'Identifier') {
return tag.name === 'styled' || STYLE_TAGS.has(tag.name);
}
return rootIdentifier(tag) === 'styled';
}
export default {
create(context) {
const reported = new Set();
const followed = new Set();
const reportedCss = new Set();
function report(property, name) {
if (reported.has(property)) {
return;
}
reported.add(property);
context.report({ node: property.key, message: MESSAGE(name) });
}
function resolveIdentifier(identifier) {
const scope = context.sourceCode.getScope(identifier);
let current = scope;
while (current) {
const variable = current.set.get(identifier.name);
if (variable) {
const definition = variable.defs[0];
if (
definition?.node?.type === 'VariableDeclarator' &&
definition.node.init
) {
return definition.node.init;
}
return null;
}
current = current.upper;
}
return null;
}
function checkObject(object) {
for (const property of object.properties) {
if (property.type === 'SpreadElement') {
checkStyle(property.argument);
continue;
}
const name = propertyName(property);
if (name && BANNED_JS.test(camelCase(name))) {
report(property, name);
}
}
}
function checkStyle(expression) {
if (!expression) {
return;
}
switch (expression.type) {
case 'ObjectExpression':
checkObject(expression);
return;
case 'ConditionalExpression':
checkStyle(expression.consequent);
checkStyle(expression.alternate);
return;
case 'LogicalExpression':
checkStyle(expression.left);
checkStyle(expression.right);
return;
case 'TSAsExpression':
case 'TSSatisfiesExpression':
case 'TSNonNullExpression':
case 'ParenthesizedExpression':
checkStyle(expression.expression);
return;
case 'CallExpression':
// useMemo(() => ({ ... }), deps)
if (
expression.callee.type === 'Identifier' &&
expression.callee.name === 'useMemo'
) {
checkReturned(expression.arguments[0]);
}
return;
case 'Identifier': {
const init = resolveIdentifier(expression);
if (!init || followed.has(init)) {
return;
}
followed.add(init);
checkStyle(init);
return;
}
default:
}
}
function checkReturned(fn) {
if (!fn || !FUNCTIONS.has(fn.type)) {
return;
}
if (fn.body.type !== 'BlockStatement') {
checkStyle(fn.body);
return;
}
for (const statement of fn.body.body) {
if (statement.type === 'ReturnStatement') {
checkStyle(statement.argument);
}
}
}
function checkStyleMap(expression) {
if (expression?.type !== 'ObjectExpression') {
return;
}
for (const property of expression.properties) {
if (property.type === 'Property') {
checkStyle(property.value);
}
}
}
// `start` is the index of the first character after the opening quote.
function checkCss(text, start) {
for (const match of text.matchAll(BANNED_CSS)) {
const index = start + match.index + match[1].length;
if (reportedCss.has(index)) {
continue;
}
reportedCss.add(index);
context.report({
loc: {
start: context.sourceCode.getLocFromIndex(index),
end: context.sourceCode.getLocFromIndex(index + match[2].length),
},
message: MESSAGE(match[2]),
});
}
}
// CSS returned from interpolations: ${(p) => p.small && 'font-size: 11px;'}
function checkCssStrings(node) {
if (!node || typeof node.type !== 'string') {
return;
}
if (node.type === 'TemplateLiteral') {
for (const quasi of node.quasis) {
checkCss(quasi.value.raw, quasi.range[0] + 1);
}
} else if (node.type === 'Literal' && typeof node.value === 'string') {
checkCss(node.raw.slice(1, -1), node.range[0] + 1);
return;
}
for (const [key, value] of Object.entries(node)) {
if (key === 'parent') {
continue;
}
if (Array.isArray(value)) {
value.forEach(checkCssStrings);
} else if (value && typeof value === 'object') {
checkCssStrings(value);
}
}
}
function checkFunction(node) {
if (isCssPropertiesType(node.returnType?.typeAnnotation)) {
checkReturned(node);
}
}
return {
JSXAttribute(node) {
if (
node.name.type !== 'JSXIdentifier' ||
node.value?.type !== 'JSXExpressionContainer'
) {
return;
}
const name = node.name.name;
if (name === 'styles') {
checkStyleMap(node.value.expression);
} else if (name === 'style' || name.endsWith('Style')) {
checkStyle(node.value.expression);
}
},
VariableDeclarator(node) {
const type = node.id.typeAnnotation?.typeAnnotation;
if (isCssPropertiesType(type)) {
checkStyle(node.init);
} else if (isCssPropertiesMapType(type)) {
checkStyleMap(node.init);
}
},
TSAsExpression(node) {
if (isCssPropertiesType(node.typeAnnotation)) {
checkStyle(node.expression);
}
},
TSSatisfiesExpression(node) {
if (isCssPropertiesType(node.typeAnnotation)) {
checkStyle(node.expression);
} else if (isCssPropertiesMapType(node.typeAnnotation)) {
checkStyleMap(node.expression);
}
},
TaggedTemplateExpression(node) {
if (!isStyleTag(node.tag)) {
return;
}
checkCssStrings(node.quasi);
},
ArrowFunctionExpression: checkFunction,
FunctionExpression: checkFunction,
FunctionDeclaration: checkFunction,
};
},
};

View File

@@ -0,0 +1,38 @@
/**
* Rule: require-disable-reason
*
* A disable directive that names one of RULES must say why after `--`:
* // oxlint-disable-next-line signoz/no-text-css -- canvas text, not DOM
*
* Directives that disable every rule are not checked.
*/
const RULES = new Set(['signoz/no-text-css']);
const DIRECTIVE = /^\s*(?:eslint|oxlint)-disable(?:-next-line|-line)?\s+(.*)$/s;
export default {
create(context) {
return {
Program() {
for (const comment of context.sourceCode.getAllComments()) {
const match = comment.value.match(DIRECTIVE);
if (!match) {
continue;
}
const [rules, reason] = match[1].split(/\s--\s?/);
const named = rules
.split(',')
.map((rule) => rule.trim())
.filter((rule) => RULES.has(rule));
if (named.length > 0 && !reason?.trim()) {
context.report({
node: comment,
message: `Disabling ${named.join(', ')} needs a reason after \`--\`.`,
});
}
}
},
};
},
};

View File

@@ -17,6 +17,8 @@ import noConditionalTextNodesWithSiblings from './rules/no-conditional-text-node
import noReturnTextNodes from './rules/no-return-text-nodes.mjs';
import noMswInStoryFile from './rules/no-msw-in-story-file.mjs';
import noDirectReactRouterImport from './rules/no-direct-react-router-import.mjs';
import noTextCss from './rules/no-text-css.mjs';
import requireDisableReason from './rules/require-disable-reason.mjs';
export default {
meta: {
@@ -35,5 +37,7 @@ export default {
'no-return-text-nodes': noReturnTextNodes,
'no-msw-in-story-file': noMswInStoryFile,
'no-direct-react-router-import': noDirectReactRouterImport,
'no-text-css': noTextCss,
'require-disable-reason': requireDisableReason,
},
};

1189
frontend/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -34,10 +34,6 @@
"title": "Partition Latency view",
"description": "Connect and Monitor Your Data Streams"
},
"dropRate": {
"title": "Drop Rate view",
"description": "Connect and Monitor Your Data Streams"
},
"metricPage": {
"title": "Metric View",
"description": "Connect and Monitor Your Data Streams"

View File

@@ -34,10 +34,6 @@
"title": "Partition Latency view",
"description": "Connect and Monitor Your Data Streams"
},
"dropRate": {
"title": "Drop Rate view",
"description": "Connect and Monitor Your Data Streams"
},
"metricPage": {
"title": "Metric View",
"description": "Connect and Monitor Your Data Streams"

View File

@@ -1746,7 +1746,7 @@ export const useTestRule = <
return useMutation(getTestRuleMutationOptions(options));
};
/**
* Returns a page of alert rules with their current evaluation state, trimmed to the fields the list page renders. Supports a filter DSL (`query`), a repeated `states` filter applied after the state overlay, sort (`updated_at`/`created_at`/`name`/`state`/`severity`), order (`asc`/`desc`), and offset-based pagination (`limit`/`offset`). In the filter DSL, a non-reserved key is matched as a rule label directly (`team = infra`); a key that collides with a reserved keyword matches either interpretation (negative operators exclude both), and `labels.<key>` targets only the label. The response also carries the org's label pairs and the reserved filter keys for building filter suggestions.
* Returns a page of alert rules with their current evaluation state, trimmed to the fields the list page renders. Supports a filter DSL (`query`), a repeated `states` filter applied after the state overlay, sort (`updated_at`/`created_at`/`name`/`state`/`thresholds`), order (`asc`/`desc`), and offset-based pagination (`limit`/`offset`). In the filter DSL, a non-reserved key is matched as a rule label directly (`team = infra`); a key that collides with a reserved keyword matches either interpretation (negative operators exclude both), and `labels.<key>` targets only the label. The response also carries the org's label pairs and the reserved filter keys for building filter suggestions.
* @summary List alert rules (v3)
*/
export const listRulesV3 = (

View File

@@ -34,6 +34,7 @@ import type {
ListServiceAccountKeys200,
ListServiceAccountKeysPathParameters,
ListServiceAccounts200,
ListServiceAccountsParams,
RenderErrorResponseDTO,
RevokeServiceAccountKeyPathParameters,
ServiceaccounttypesPostableFactorAPIKeyDTO,
@@ -334,38 +335,48 @@ export const invalidateGetServiceAccountRole = async (
};
/**
* This endpoint lists the service accounts for an organisation
* Returns a page of the service accounts for an organisation. `query` is a filter expression over name, email, status, created_at and updated_at, for example `status = 'active'`; `sort`/`order` pick the ordering and `limit`/`offset` the page.
* @summary List service accounts
*/
export const listServiceAccounts = (signal?: AbortSignal) => {
export const listServiceAccounts = (
params?: ListServiceAccountsParams,
signal?: AbortSignal,
) => {
return GeneratedAPIInstance<ListServiceAccounts200>({
url: `/api/v1/service_accounts`,
method: 'GET',
params,
signal,
});
};
export const getListServiceAccountsQueryKey = () => {
return [`/api/v1/service_accounts`] as const;
export const getListServiceAccountsQueryKey = (
params?: ListServiceAccountsParams,
) => {
return [`/api/v1/service_accounts`, ...(params ? [params] : [])] as const;
};
export const getListServiceAccountsQueryOptions = <
TData = Awaited<ReturnType<typeof listServiceAccounts>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listServiceAccounts>>,
TError,
TData
>;
}) => {
>(
params?: ListServiceAccountsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listServiceAccounts>>,
TError,
TData
>;
},
) => {
const { query: queryOptions } = options ?? {};
const queryKey = queryOptions?.queryKey ?? getListServiceAccountsQueryKey();
const queryKey =
queryOptions?.queryKey ?? getListServiceAccountsQueryKey(params);
const queryFn: QueryFunction<
Awaited<ReturnType<typeof listServiceAccounts>>
> = ({ signal }) => listServiceAccounts(signal);
> = ({ signal }) => listServiceAccounts(params, signal);
return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
Awaited<ReturnType<typeof listServiceAccounts>>,
@@ -386,14 +397,17 @@ export type ListServiceAccountsQueryError = ErrorType<RenderErrorResponseDTO>;
export function useListServiceAccounts<
TData = Awaited<ReturnType<typeof listServiceAccounts>>,
TError = ErrorType<RenderErrorResponseDTO>,
>(options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listServiceAccounts>>,
TError,
TData
>;
}): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListServiceAccountsQueryOptions(options);
>(
params?: ListServiceAccountsParams,
options?: {
query?: UseQueryOptions<
Awaited<ReturnType<typeof listServiceAccounts>>,
TError,
TData
>;
},
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
const queryOptions = getListServiceAccountsQueryOptions(params, options);
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
queryKey: QueryKey;
@@ -407,10 +421,11 @@ export function useListServiceAccounts<
*/
export const invalidateListServiceAccounts = async (
queryClient: QueryClient,
params?: ListServiceAccountsParams,
options?: InvalidateOptions,
): Promise<QueryClient> => {
await queryClient.invalidateQueries(
{ queryKey: getListServiceAccountsQueryKey() },
{ queryKey: getListServiceAccountsQueryKey(params) },
options,
);

View File

@@ -13018,7 +13018,7 @@ export enum RuletypesListSortDTO {
created_at = 'created_at',
name = 'name',
state = 'state',
severity = 'severity',
thresholds = 'thresholds',
}
/**
* The labels attached to alerts the rule fires.
@@ -13077,6 +13077,11 @@ export interface RuletypesListableRuleDTO {
* @description The current evaluation state: inactive, pending, recovering, firing, nodata or disabled.
*/
state: RuletypesAlertStateDTO;
/**
* @type array
* @description The rule's threshold names in lowercase, deduplicated and ordered critical, error, warning, info, then other names. An alert carries the name of the threshold that fired as its severity. Read-only.
*/
thresholds: string[];
/**
* @type string
* @format date-time
@@ -13099,7 +13104,7 @@ export interface RuletypesRuleViewDataDTO {
*/
query?: string;
/**
* @description The field to sort by: updated_at (the default), created_at, name, state or severity.
* @description The field to sort by: updated_at (the default), created_at, name, state or thresholds. Sorting by thresholds ranks each rule by its first threshold name.
*/
sort?: RuletypesListSortDTO;
/**
@@ -13612,6 +13617,13 @@ export interface SavedviewtypesUpdatableSavedViewDTO {
spec: SavedviewtypesSavedViewSpecDTO;
}
export enum ServiceaccounttypesDSLKeyDTO {
created_at = 'created_at',
email = 'email',
name = 'name',
status = 'status',
updated_at = 'updated_at',
}
export interface ServiceaccounttypesGettableFactorAPIKeyDTO {
/**
* @type string
@@ -13658,6 +13670,59 @@ export interface ServiceaccounttypesGettableFactorAPIKeyWithKeyDTO {
key: string;
}
export enum ServiceaccounttypesServiceAccountStatusDTO {
active = 'active',
deleted = 'deleted',
}
export interface ServiceaccounttypesServiceAccountDTO {
/**
* @type string
* @format date-time
*/
createdAt: string;
/**
* @type string
*/
email: string;
/**
* @type string
*/
id: string;
/**
* @type string
*/
name: string;
/**
* @type string
*/
orgId: string;
status: ServiceaccounttypesServiceAccountStatusDTO;
/**
* @type string
* @format date-time
*/
updatedAt: string;
}
export interface ServiceaccounttypesListableServiceAccountDTO {
/**
* @type array
* @description The filter keys the query accepts.
*/
reservedKeywords: ServiceaccounttypesDSLKeyDTO[];
/**
* @type array
* @description The service accounts on this page.
*/
serviceAccounts: ServiceaccounttypesServiceAccountDTO[];
/**
* @type integer
* @format int64
* @description The number of service accounts the filter matches across all pages.
*/
total: number;
}
export interface ServiceaccounttypesPostableFactorAPIKeyDTO {
/**
* @type integer
@@ -13688,39 +13753,15 @@ export interface ServiceaccounttypesPostableServiceAccountRoleDTO {
serviceAccountId: string;
}
export interface ServiceaccounttypesServiceAccountDTO {
/**
* @type string
* @format date-time
*/
createdAt?: string;
/**
* @type string
*/
email: string;
/**
* @type string
*/
id: string;
/**
* @type string
*/
name: string;
/**
* @type string
*/
orgId: string;
/**
* @type string
*/
status: string;
/**
* @type string
* @format date-time
*/
updatedAt?: string;
export enum ServiceaccounttypesServiceAccountListOrderDTO {
asc = 'asc',
desc = 'desc',
}
export enum ServiceaccounttypesServiceAccountListSortDTO {
created_at = 'created_at',
updated_at = 'updated_at',
name = 'name',
}
export interface ServiceaccounttypesServiceAccountRoleDTO {
/**
* @type string
@@ -13752,7 +13793,7 @@ export interface ServiceaccounttypesServiceAccountWithRolesDTO {
* @type string
* @format date-time
*/
createdAt?: string;
createdAt: string;
/**
* @type string
*/
@@ -13773,15 +13814,12 @@ export interface ServiceaccounttypesServiceAccountWithRolesDTO {
* @type array,null
*/
serviceAccountRoles: ServiceaccounttypesServiceAccountRoleDTO[] | null;
/**
* @type string
*/
status: string;
status: ServiceaccounttypesServiceAccountStatusDTO;
/**
* @type string
* @format date-time
*/
updatedAt?: string;
updatedAt: string;
}
export interface ServiceaccounttypesUpdatableFactorAPIKeyDTO {
@@ -15829,11 +15867,34 @@ export type GetServiceAccountRole200 = {
status: string;
};
export type ListServiceAccounts200 = {
export type ListServiceAccountsParams = {
/**
* @type array
* @type string
* @description A filter expression over the reserved keys name, email, status, created_at and updated_at using the SigNoz filter grammar: comparisons such as =, !=, CONTAINS, LIKE, IN, < and >, single-quoted strings, RFC3339 timestamps in quotes for created_at and updated_at, combined with AND, OR and NOT, for example name CONTAINS 'ci' AND status = 'active'. A bare or quoted token without a key matches name or email case-insensitively. At most 1024 characters. Empty matches every service account.
*/
data: ServiceaccounttypesServiceAccountDTO[];
query?: string;
/**
* @description The sort column: created_at (default), updated_at or name.
*/
sort?: ServiceaccounttypesServiceAccountListSortDTO;
/**
* @description The sort order: asc or desc (default).
*/
order?: ServiceaccounttypesServiceAccountListOrderDTO;
/**
* @type integer
* @description The page size; defaults to 20 and is capped at 200.
*/
limit?: number;
/**
* @type integer
* @description The number of service accounts to skip; defaults to 0.
*/
offset?: number;
};
export type ListServiceAccounts200 = {
data: ServiceaccounttypesListableServiceAccountDTO;
/**
* @type string
*/
@@ -17585,7 +17646,7 @@ export type ListRulesV3Params = {
*/
states?: string[];
/**
* @description The field to sort by: updated_at (the default), created_at, name, state or severity.
* @description The field to sort by: updated_at (the default), created_at, name, state or thresholds. Sorting by thresholds ranks each rule by its first threshold name.
*/
sort?: RuletypesListSortDTO;
/**

View File

@@ -12,7 +12,6 @@ export interface MessagingQueueServicePayload {
service_name?: string;
};
detailType?: MessagingQueueServiceDetailType | 'producer' | 'consumer';
evalTime?: number;
}
export interface MessagingQueuesPayloadProps {

View File

@@ -1,23 +0,0 @@
import axios from 'api';
import { DropRateAPIResponse } from 'pages/MessagingQueues/MQDetails/DropRateView/dropRateViewUtils';
import { ErrorResponse, SuccessResponse } from 'types/api';
import { MessagingQueueServicePayload } from './getConsumerLagDetails';
export const getKafkaSpanEval = async (
props: Omit<MessagingQueueServicePayload, 'detailType' | 'variables'>,
): Promise<SuccessResponse<DropRateAPIResponse['data']> | ErrorResponse> => {
const { start, end, evalTime } = props;
const response = await axios.post(`messaging-queues/kafka/span/evaluation`, {
start,
end,
eval_time: evalTime,
});
return {
statusCode: 200,
error: null,
message: response.data.status,
payload: response.data.data,
};
};

View File

@@ -1,5 +1,6 @@
import { useMutation } from 'react-query';
import { Button, Modal } from 'antd';
import { Button } from '@signozhq/ui/button';
import { Dialog } from '@signozhq/ui/dialog';
import { Typography } from '@signozhq/ui/typography';
import { createSubscription } from 'api/generated/services/subscriptions';
import type { CreateSubscription201 } from 'api/generated/services/sigNoz.schemas';
@@ -55,46 +56,51 @@ function AddCreditCardModal({
};
return (
<Modal
className="add-credit-card-modal"
title={<span className="title">Add Credit Card for Chat Support</span>}
<Dialog
open={open}
closable
onCancel={onClose}
destroyOnClose
footer={[
<Button
key="cancel"
onClick={onClose}
className="cancel-btn"
icon={<X size={16} />}
>
Cancel
</Button>,
<AuthZTooltip
key="submit"
checks={[SubscriptionCreatePermission]}
withPortal={false}
>
onClose={onClose}
title="Add Credit Card for Chat Support"
testId="add-credit-card-modal"
footerSuffix={
<>
<Button
type="primary"
icon={<CreditCard size={16} />}
size="middle"
loading={isLoadingBilling}
disabled={isLoadingBilling}
onClick={handleAddCreditCard}
className="add-credit-card-btn"
variant="outlined"
color="secondary"
size="md"
prefix={<X size={16} />}
onClick={onClose}
testId="add-credit-card-cancel"
>
Add Credit Card
Cancel
</Button>
</AuthZTooltip>,
]}
<AuthZTooltip checks={[SubscriptionCreatePermission]}>
<Button
variant="solid"
color="primary"
size="md"
prefix={<CreditCard size={16} />}
loading={isLoadingBilling}
onClick={handleAddCreditCard}
testId="add-credit-card-submit"
>
Add Credit Card
</Button>
</AuthZTooltip>
</>
}
>
<Typography.Text className="add-credit-card-text">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
You&apos;re currently on <span className="highlight-text">Trial plan</span>.
Add a credit card to access SigNoz chat support to your workspace.
</Typography.Text>
</Modal>
</Typography>
</Dialog>
);
}

View File

@@ -1,6 +1,9 @@
.breadcrumb {
padding: var(--spacing-4) 16px var(--spacing-2);
// The antd breadcrumb provides the item spacing.
--button-padding: 0;
ol {
align-items: center;
}
@@ -8,13 +11,4 @@
:global(.ant-breadcrumb-separator) {
color: var(--muted-foreground);
}
[data-slot='button'] {
padding: 0px;
}
}
.divider {
--divider-color: var(--l1-border);
--divider-margin: 10px 0 16px 0;
}

View File

@@ -28,7 +28,7 @@ function AlertBreadcrumb({
items={breadcrumbItems}
data-testid={testId}
/>
{showDivider && <Divider className={styles.divider} />}
{showDivider && <Divider spacing="10px 16px" />}
</>
);
}

View File

@@ -1,5 +1,4 @@
.itemLast {
color: var(--button-secondary-label);
font-size: var(--button-font-size, var(--periscope-font-size-base));
line-height: var(--button-size-line-height, 16px);
}

View File

@@ -1,6 +1,6 @@
import { Copy } from '@signozhq/icons';
import { Badge, type BadgeColorType } from '@signozhq/ui/badge';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { Tooltip } from '@signozhq/ui/tooltip';
import cx from 'classnames';
import { useLayoutEffect, useRef, useState } from 'react';
@@ -15,12 +15,14 @@ export interface LabelColumnProps {
labels: string[];
color?: BadgeColorType;
value?: { [key: string]: string };
testId?: string;
}
function LabelColumn({
labels,
value,
color = 'primary',
testId = 'label-column',
}: LabelColumnProps): JSX.Element {
const containerRef = useRef<HTMLDivElement>(null);
const [visibleCount, setVisibleCount] = useState(labels.length);
@@ -56,11 +58,7 @@ function LabelColumn({
const remainingLabels = labels.slice(visibleCount);
return (
<div
ref={containerRef}
className={styles.labelColumn}
data-testid="label-column"
>
<div ref={containerRef} className={styles.labelColumn} data-testid={testId}>
{labels.map((label, index) => (
<LabelTag
key={label}

View File

@@ -1,6 +1,6 @@
import { Copy } from '@signozhq/icons';
import { Badge, type BadgeColorType } from '@signozhq/ui/badge';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { Tooltip } from '@signozhq/ui/tooltip';
import { useCopyToClipboard } from 'react-use';

View File

@@ -26,8 +26,6 @@
}
.brand-title {
font-size: 20px;
font-weight: 600;
color: var(--l1-foreground); // Primary text
margin: 0;
}

View File

@@ -28,15 +28,29 @@ function AppLoading(): JSX.Element {
<div className="brand">
<img src={signozBrandLogoUrl} alt="SigNoz" className="brand-logo" />
<Typography.Title level={2} className="brand-title">
<Typography
variant="label"
size="large"
weight="bold"
color="main"
as="h2"
textOverflow="wrap"
>
SigNoz
</Typography.Title>
</Typography>
</div>
<div className="brand-tagline">
<Typography.Text>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
OpenTelemetry-Native Logs, Metrics and Traces in a single pane
</Typography.Text>
</Typography>
</div>
<div className="loader" />

View File

@@ -0,0 +1,9 @@
import { Toaster } from '@signozhq/ui/toast';
const PAGE_INSET = { bottom: 'var(--bottom-strip-height, 0px)' };
function AppToaster(): JSX.Element {
return <Toaster position="bottom-right" pageInset={PAGE_INSET} />;
}
export default AppToaster;

View File

@@ -35,7 +35,6 @@
&__error-code {
color: var(--bg-cherry-100);
font-size: 13px;
font-weight: 500;
line-height: 1;
letter-spacing: -0.065px;
}
@@ -43,8 +42,6 @@
&__error-message {
color: var(--bg-cherry-300);
font-size: 13px;
font-weight: 400;
line-height: 20px;
letter-spacing: -0.065px;
}
@@ -75,7 +72,6 @@
&__message-item {
color: var(--bg-cherry-300);
font-size: 13px;
font-weight: 400;
line-height: 20px;
letter-spacing: -0.065px;

View File

@@ -45,9 +45,8 @@
}
.auth-footer-text {
font-family: var(--font-family-inter, Inter, sans-serif);
font-family: var(--label-small-400-font-family);
font-size: 11px;
font-weight: 400;
line-height: 1;
color: var(--l2-foreground);
text-align: center;
@@ -57,7 +56,6 @@
display: flex;
align-items: center;
gap: 6px;
text-decoration: none;
transition: opacity 0.2s ease;
&:hover {

View File

@@ -16,7 +16,6 @@
display: flex;
align-items: center;
gap: 4.9px;
text-decoration: none;
}
.auth-header-logo-icon {
@@ -26,7 +25,7 @@
}
.auth-header-logo-text {
font-family: Satoshi, var(--font-family-inter, Inter), sans-serif;
font-family: Satoshi, var(--label-medium-500-font-family), sans-serif;
font-size: 15.4px;
font-weight: 500;
line-height: 17.5px;

View File

@@ -17,8 +17,3 @@
letter-spacing: -0.01em;
color: var(--l1-foreground);
}
.divider {
--divider-color: var(--l1-border);
--divider-margin: 10px 0 16px 0;
}

View File

@@ -44,7 +44,7 @@ function BackHeader({
</Button>
<div className={styles.title}>{title}</div>
</div>
<Divider className={styles.divider} />
<Divider spacing="10px 16px" />
</>
);
}

View File

@@ -23,7 +23,6 @@
.ant-table {
.ant-table-thead > tr > th {
padding: 12px;
font-weight: 500;
font-size: 12px;
line-height: 18px;
@@ -31,10 +30,7 @@
border-bottom: none;
color: var(--l2-foreground);
font-family: Inter;
font-size: 11px;
font-style: normal;
font-weight: 600;
line-height: 18px; /* 163.636% */
letter-spacing: 0.44px;
@@ -45,7 +41,6 @@
.ant-table-cell {
padding: 12px;
font-size: 13px;
line-height: 20px;
color: var(--l1-foreground);
background: var(--l1-background);
@@ -67,12 +62,6 @@
.ant-table-cell:nth-child(n + 3) {
padding-right: 24px;
}
.column-header-right {
text-align: right;
}
.column-header-left {
text-align: left;
}
.ant-table-tbody > tr > td {
border-bottom: none;
}

View File

@@ -40,10 +40,27 @@ const INITIAL_PAGE_SIZE = 20;
const showPaginationItem = (total: number, range: number[]): JSX.Element => (
<>
<Typography.Text className="numbers">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
{range[0]} &#8212; {range[1]}
</Typography.Text>
<Typography.Text className="total"> of {total}</Typography.Text>
</Typography>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
{' '}
of {total}
</Typography>
</>
);
@@ -56,22 +73,15 @@ function ProgressRender(item: string | number): JSX.Element {
const percent = Number(Number(item).toFixed(1));
return (
<div className="progress-container">
<Progress
percent={percent}
strokeLinecap="butt"
showInfo
strokeColor={((): string => {
const cpuPercent = percent;
if (cpuPercent >= 90) {
return Color.BG_SAKURA_500;
<div className="progress-bar">
<Progress
percent={percent}
showInfo
color={
percent >= 90 ? 'highlight-danger' : percent >= 60 ? 'warning' : 'success'
}
if (cpuPercent >= 60) {
return Color.BG_AMBER_500;
}
return Color.BG_FOREST_500;
})()}
className="progress-bar"
/>
/>
</div>
</div>
);
}
@@ -526,7 +536,18 @@ export default function CeleryOverviewTable({
),
}}
locale={{
emptyText: isLoading ? null : <Typography.Text>No data</Typography.Text>,
emptyText: isLoading ? null : (
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
No data
</Typography>
),
}}
scroll={{ x: 'max-content' }}
showSorterTooltip

View File

@@ -24,9 +24,16 @@ function CeleryTaskConfigOptions(): JSX.Element {
return (
<div className="celery-task-filters">
<div className="celery-filters">
<Typography.Text style={{ whiteSpace: 'nowrap' }}>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="visible"
>
Task Name
</Typography.Text>
</Typography>
<Select
data-testid="celery-task-name-select"
placeholder="Task Name"

View File

@@ -49,11 +49,7 @@
.subtitle {
color: var(--l2-foreground);
font-family: Inter;
font-size: 12px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
}
}
@@ -64,11 +60,6 @@
.footer-text {
color: var(--l2-foreground);
font-family: Inter;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
}
}
}

View File

@@ -65,15 +65,38 @@ export default function CeleryTaskDetail({
width="45%"
title={
<div>
<Typography.Text className="title">{`Details - ${taskData.entity}`}</Typography.Text>
<Typography
variant="label"
size="large"
weight="bold"
color="main"
as="span"
textOverflow="wrap"
>{`Details - ${taskData.entity}`}</Typography>
<div>
<Typography.Text className="subtitle">
<Typography
variant="paragraph"
size="small"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
{`${formatTimestamp(startTime)} ${
endTime ? `- ${formatTimestamp(endTime)}` : ''
}`}
</Typography.Text>
<Divider type="vertical" />
<Typography.Text className="subtitle">{taskData.value}</Typography.Text>
</Typography>
<Divider orientation="vertical" />
<Typography
variant="paragraph"
size="small"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
{taskData.value}
</Typography>
</div>
</div>
}
@@ -88,7 +111,14 @@ export default function CeleryTaskDetail({
destroyOnClose
closeIcon={<X size={16} style={{ marginTop: Spacing.MARGIN_1 }} />}
footer={
<Typography.Text className="footer-text">{`Total Task: ${totalTask}`}</Typography.Text>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>{`Total Task: ${totalTask}`}</Typography>
}
>
<CeleryTaskGraph

View File

@@ -7,11 +7,11 @@ import { useAppLocation } from 'lib/router/useAppLocation';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { ViewMenuAction } from 'container/WidgetCard/config';
import { ENTITY_VERSION_V5 } from 'constants/app';
import GridCard from 'container/WidgetCard/Card';
import { Card } from 'container/WidgetCard/styles';
import { useIsDarkMode } from 'hooks/useDarkMode';
import useUrlQuery from 'hooks/useUrlQuery';
import { isEmpty } from 'lodash-es';
import { getStartAndEndTimesInMilliseconds } from 'pages/MessagingQueues/MessagingQueuesUtils';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
@@ -33,6 +33,7 @@ import {
celerySlowestTasksTableWidgetData,
celerySuccessStateWidgetData,
celerySuccessTasksTableWidgetData,
getClickedSeries,
} from './CeleryTaskGraphUtils';
import {
CeleryTaskState,
@@ -142,24 +143,19 @@ function CeleryTaskBar({
data?: {
[key: string]: string;
},
queryData?: { inFocusOrNot: boolean },
): void => {
const clickedSeries = getClickedSeries(data, queryData);
if (!clickedSeries) {
return;
}
const { start, end } = getStartAndEndTimesInMilliseconds(xValue);
// Extract entity and value from data
const [firstDataPoint] = Object.entries(data || {});
const [entity, value] = (firstDataPoint || ([] as unknown)) as [
string,
string,
];
if (!isEmpty(entity) || !isEmpty(value)) {
onClick?.({
entity,
value,
timeRange: [start, end],
widgetData,
});
}
onClick?.({
...clickedSeries,
timeRange: [start, end],
widgetData,
});
};
const { getCustomSeries } = useGetGraphCustomSeries({
@@ -183,10 +179,11 @@ function CeleryTaskBar({
{barState === CeleryTaskState.All && (
<GridCard
widget={celeryAllStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
onClickHandler={(xValue, yValue, mouseX, mouseY, data): void =>
onClickHandler={(xValue, yValue, mouseX, mouseY, data, queryData): void =>
onGraphClick(
celerySlowestTasksTableWidgetData,
xValue,
@@ -194,6 +191,7 @@ function CeleryTaskBar({
mouseX,
mouseY,
data,
queryData,
)
}
customSeries={getCustomSeries}
@@ -203,10 +201,11 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Failed && (
<GridCard
widget={celeryFailedStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
onClickHandler={(xValue, yValue, mouseX, mouseY, data): void =>
onClickHandler={(xValue, yValue, mouseX, mouseY, data, queryData): void =>
onGraphClick(
celeryFailedTasksTableWidgetData,
xValue,
@@ -214,6 +213,7 @@ function CeleryTaskBar({
mouseX,
mouseY,
data,
queryData,
)
}
customSeries={getCustomSeries}
@@ -222,10 +222,11 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Retry && (
<GridCard
widget={celeryRetryStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
onClickHandler={(xValue, yValue, mouseX, mouseY, data): void =>
onClickHandler={(xValue, yValue, mouseX, mouseY, data, queryData): void =>
onGraphClick(
celeryRetryTasksTableWidgetData,
xValue,
@@ -233,6 +234,7 @@ function CeleryTaskBar({
mouseX,
mouseY,
data,
queryData,
)
}
customSeries={getCustomSeries}
@@ -241,10 +243,11 @@ function CeleryTaskBar({
{barState === CeleryTaskState.Successful && (
<GridCard
widget={celerySuccessStateFilteredData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
isQueryEnabled={queryEnabled}
onClickHandler={(xValue, yValue, mouseX, mouseY, data): void =>
onClickHandler={(xValue, yValue, mouseX, mouseY, data, queryData): void =>
onGraphClick(
celerySuccessTasksTableWidgetData,
xValue,
@@ -252,6 +255,7 @@ function CeleryTaskBar({
mouseX,
mouseY,
data,
queryData,
)
}
customSeries={getCustomSeries}

View File

@@ -48,15 +48,11 @@
}
.worker-count-text-container {
--typography-font-size: 2.5vw;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
.celery-task-graph-worker-count-text {
font-size: 2.5vw;
text-align: center;
}
}
.worker-count-header {
@@ -148,14 +144,12 @@
.configure-option-Info-text {
color: var(--l2-foreground);
font-size: 12px;
font-weight: 400;
}
}
.row-panel {
border-radius: 4px;
background: color-mix(in srgb, var(--card) 40%, transparent);
background: color-mix(in srgb, var(--surface-2) 40%, transparent);
padding: 8px;
display: flex;
gap: 6px;
@@ -217,7 +211,6 @@
}
&__label {
font-family: 'Inter';
font-size: 14px;
color: var(--l2-foreground);
line-height: 20px;
@@ -225,7 +218,7 @@
}
&__value {
font-family: 'Geist Mono';
font-family: var(--code-base-400-font-family);
font-size: 24px;
color: var(--l1-foreground);
line-height: 32px;

View File

@@ -1,7 +1,7 @@
import { useCallback, useMemo } from 'react';
// eslint-disable-next-line no-restricted-imports
import { useDispatch } from 'react-redux';
import { ENTITY_VERSION_V4 } from 'constants/app';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { navigate } from 'lib/router/navigation';
import { useAppLocation } from 'lib/router/useAppLocation';
import { QueryParams } from 'constants/query';
@@ -22,7 +22,10 @@ import {
applyCeleryFilterOnWidgetData,
getFiltersFromQueryParams,
} from '../CeleryUtils';
import { celeryTimeSeriesTablesWidgetData } from './CeleryTaskGraphUtils';
import {
celeryTimeSeriesTablesWidgetData,
getClickedSeries,
} from './CeleryTaskGraphUtils';
function CeleryTaskGraph({
widgetData,
@@ -102,13 +105,21 @@ function CeleryTaskGraph({
widget={applyCeleryTaskFilter ? updatedWidgetData : widgetData}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={(xValue, _yValue, _mouseX, _mouseY, data): void => {
onClickHandler={(
xValue,
_yValue,
_mouseX,
_mouseY,
data,
queryData,
): void => {
const clickedSeries = getClickedSeries(data, queryData);
if (!clickedSeries) {
return;
}
const { entity, value } = clickedSeries;
const { start, end } = getStartAndEndTimesInMilliseconds(xValue);
// Extract entity and value from data
const [firstDataPoint] = Object.entries(data || {});
const [entity, value] = firstDataPoint || [];
const widgetData = celeryTimeSeriesTablesWidgetData(
entity,
value,
@@ -126,7 +137,7 @@ function CeleryTaskGraph({
isQueryEnabled={queryEnabled}
openTracesButton={openTracesButton}
onOpenTraceBtnClick={onOpenTraceBtnClick}
version={ENTITY_VERSION_V4}
version={ENTITY_VERSION_V5}
customErrorMessage={customErrorMessage}
start={start}
end={end}

View File

@@ -104,9 +104,16 @@ export default function CeleryTaskGraphGrid({
<CardContainer className="row-card" isDarkMode={isDarkMode}>
<div className="row-panel">
<div className="row-panel-section">
<Typography.Text className="section-title">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
Flower Metrics
</Typography.Text>
</Typography>
{collapsedSections.metricBasedGraphs ? (
<ChevronDown
size={14}
@@ -137,17 +144,31 @@ export default function CeleryTaskGraphGrid({
/>
<Card className="celery-task-graph-worker-count">
<div className="worker-count-header">
<Typography.Text className="worker-count-header-text">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
Worker Online
</Typography.Text>
</Typography>
</div>
<div className="worker-count-text-container">
<Typography.Text
className="celery-task-graph-worker-count-text"
data-testid="celery-worker-count"
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
display="inline-block"
align="center"
textOverflow="wrap"
testId="celery-worker-count"
>
{workerCount ?? '-'}
</Typography.Text>
</Typography>
</div>
</Card>
</div>
@@ -158,9 +179,16 @@ export default function CeleryTaskGraphGrid({
<CardContainer className="row-card" isDarkMode={isDarkMode}>
<div className="row-panel">
<div className="row-panel-section">
<Typography.Text className="section-title">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
Span Based Stats
</Typography.Text>
</Typography>
{collapsedSections.traceBasedGraphs ? (
<ChevronDown
size={14}
@@ -179,9 +207,16 @@ export default function CeleryTaskGraphGrid({
</CardContainer>
<div className="configure-option-Info">
{configureOptionComponent}
<Typography.Text className="configure-option-Info-text">
<Typography
variant="paragraph"
size="small"
weight="regular"
color="secondary"
as="span"
textOverflow="wrap"
>
Click on a graph co-ordinate to see more details
</Typography.Text>
</Typography>
</div>
</div>
{!collapsedSections.traceBasedGraphs && (

View File

@@ -9,9 +9,11 @@ import {
} from 'api/generated/services/sigNoz.schemas';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { getWidgetQueryBuilder } from 'container/MetricsApplication/MetricsApplication.factory';
import { getFiltersFromKeyValue } from 'pages/Celery/CeleryOverview/CeleryOverviewUtils';
import { getWidgetQuery } from 'pages/MessagingQueues/MQDetails/MetricPage/MetricPageUtil';
import { Widgets } from 'types/api/widgets/widget';
import { DataTypes } from 'types/api/queryBuilder/queryAutocompleteResponse';
import { TagFilterItem } from 'types/api/queryBuilder/queryBuilderData';
import { DataSource, ReduceOperators } from 'types/common/queryBuilder';
import { v4 as uuidv4 } from 'uuid';
@@ -40,6 +42,29 @@ export const getStepInterval = (startTime: number, endTime: number): number => {
return 54000; // More than a week (use monthly interval)
};
// v5 returns spans without the group-by key as an empty-label series.
const groupByKeyExists = (key: string): TagFilterItem =>
getFiltersFromKeyValue(key, '', 'tag', 'exists');
const latencyExpression = (type: string): string =>
`${type || 'p99'}(duration_nano)`;
// Without a hovered series, the click data holds only `clickedTimestamp`.
export const getClickedSeries = (
data?: Record<string, string>,
queryData?: { inFocusOrNot: boolean },
): { entity: string; value: string } | undefined => {
const series = Object.entries(data || {}).find(
([key]) => key !== 'clickedTimestamp',
);
if (!queryData?.inFocusOrNot || !series) {
return undefined;
}
const [entity, value] = series;
return { entity, value };
};
// State Graphs
export const celeryAllStateWidgetData = (
startTime: number,
@@ -56,11 +81,12 @@ export const celeryAllStateWidgetData = (
type: '',
},
aggregateOperator: 'count',
aggregations: [{ expression: 'count()' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [],
items: [groupByKeyExists('celery.state')],
op: 'AND',
},
functions: [],
@@ -108,11 +134,13 @@ export const celeryRetryStateWidgetData = (
type: '',
},
aggregateOperator: 'count',
aggregations: [{ expression: 'count()' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.hostname'),
{
id: uuidv4(),
key: {
@@ -168,11 +196,13 @@ export const celeryFailedStateWidgetData = (
type: '',
},
aggregateOperator: 'count',
aggregations: [{ expression: 'count()' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.hostname'),
{
id: uuidv4(),
key: {
@@ -228,11 +258,13 @@ export const celerySuccessStateWidgetData = (
type: '',
},
aggregateOperator: 'count',
aggregations: [{ expression: 'count()' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.hostname'),
{
id: uuidv4(),
key: {
@@ -287,11 +319,12 @@ export const celeryTasksByWorkerWidgetData = (
type: '',
},
aggregateOperator: 'rate',
aggregations: [{ expression: 'rate()' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [],
items: [groupByKeyExists('celery.hostname')],
op: 'AND',
},
functions: [],
@@ -331,8 +364,9 @@ export const celeryErrorByWorkerWidgetData = (
dataSource: DataSource.TRACES,
queryName: 'A',
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
aggregateAttribute: {
dataType: 'string',
dataType: DataTypes.String,
id: 'span_id--string----true',
key: 'span_id',
type: '',
@@ -342,6 +376,7 @@ export const celeryErrorByWorkerWidgetData = (
functions: [],
filters: {
items: [
groupByKeyExists('celery.hostname'),
{
id: uuidv4(),
key: {
@@ -374,11 +409,12 @@ export const celeryErrorByWorkerWidgetData = (
reduceTo: ReduceOperators.AVG,
},
{
dataSource: 'traces',
dataSource: DataSource.TRACES,
queryName: 'B',
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
aggregateAttribute: {
dataType: 'string',
dataType: DataTypes.String,
id: 'span_id--string----true',
key: 'span_id',
type: '',
@@ -387,7 +423,7 @@ export const celeryErrorByWorkerWidgetData = (
spaceAggregation: 'sum',
functions: [],
filters: {
items: [],
items: [groupByKeyExists('celery.hostname')],
op: 'AND',
},
expression: 'B',
@@ -407,12 +443,14 @@ export const celeryErrorByWorkerWidgetData = (
legend: '',
reduceTo: ReduceOperators.AVG,
},
],
queryFormulas: [
{
queryName: 'F1',
expression: '(A/B)*100',
disabled: false,
legend: '{{celery.hostname}}',
} as any,
},
],
yAxisUnit: 'percent',
}),
@@ -435,11 +473,12 @@ export const celeryLatencyByWorkerWidgetData = (
type: '',
},
aggregateOperator: 'p99',
aggregations: [{ expression: 'p99(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [],
items: [groupByKeyExists('celery.hostname')],
op: 'AND',
},
functions: [],
@@ -532,11 +571,12 @@ export const celeryTaskLatencyWidgetData = (
type: '',
},
aggregateOperator: type || 'p99',
aggregations: [{ expression: latencyExpression(type) }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [],
items: [groupByKeyExists('celery.task_name')],
op: 'AND',
},
functions: [],
@@ -553,7 +593,7 @@ export const celeryTaskLatencyWidgetData = (
limit: null,
orderBy: [
{
columnName: '#SIGNOZ_VALUE',
columnName: latencyExpression(type),
order: 'asc',
},
],
@@ -583,11 +623,12 @@ export const celerySlowestTasksTableWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'avg',
aggregations: [{ expression: 'avg(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [],
items: [groupByKeyExists('celery.task_name')],
op: 'AND',
},
functions: [],
@@ -604,7 +645,7 @@ export const celerySlowestTasksTableWidgetData = getWidgetQueryBuilder(
limit: 10,
orderBy: [
{
columnName: '#SIGNOZ_VALUE',
columnName: 'avg(duration_nano)',
order: 'desc',
},
],
@@ -633,11 +674,13 @@ export const celeryRetryTasksTableWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'avg',
aggregations: [{ expression: 'avg(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.task_name'),
{
id: uuidv4(),
key: {
@@ -666,7 +709,7 @@ export const celeryRetryTasksTableWidgetData = getWidgetQueryBuilder(
limit: 10,
orderBy: [
{
columnName: '#SIGNOZ_VALUE',
columnName: 'avg(duration_nano)',
order: 'desc',
},
],
@@ -696,11 +739,13 @@ export const celeryFailedTasksTableWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'avg',
aggregations: [{ expression: 'avg(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.task_name'),
{
id: uuidv4(),
key: {
@@ -729,7 +774,7 @@ export const celeryFailedTasksTableWidgetData = getWidgetQueryBuilder(
limit: null,
orderBy: [
{
columnName: '#SIGNOZ_VALUE',
columnName: 'avg(duration_nano)',
order: 'desc',
},
],
@@ -757,11 +802,13 @@ export const celerySuccessTasksTableWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'avg',
aggregations: [{ expression: 'avg(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.task_name'),
{
id: uuidv4(),
key: {
@@ -790,7 +837,7 @@ export const celerySuccessTasksTableWidgetData = getWidgetQueryBuilder(
limit: null,
orderBy: [
{
columnName: '#SIGNOZ_VALUE',
columnName: 'avg(duration_nano)',
order: 'desc',
},
],
@@ -824,11 +871,13 @@ export const celeryTimeSeriesTablesWidgetData = (
type: '',
},
aggregateOperator: 'avg',
aggregations: [{ expression: 'avg(duration_nano)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
filters: {
items: [
groupByKeyExists('celery.task_name'),
{
id: uuidv4(),
key: {
@@ -882,6 +931,7 @@ export const celeryAllStateCountWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
@@ -919,6 +969,7 @@ export const celerySuccessStateCountWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
@@ -968,6 +1019,7 @@ export const celeryFailedStateCountWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',
@@ -1017,6 +1069,7 @@ export const celeryRetryStateCountWidgetData = getWidgetQueryBuilder(
type: '',
},
aggregateOperator: 'count_distinct',
aggregations: [{ expression: 'count_distinct(span_id)' }],
dataSource: DataSource.TRACES,
disabled: false,
expression: 'A',

View File

@@ -9,6 +9,7 @@ import logEvent from 'api/common/logEvent';
import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { ViewMenuAction } from 'container/WidgetCard/config';
import { ENTITY_VERSION_V5 } from 'constants/app';
import GridCard from 'container/WidgetCard/Card';
import { Card } from 'container/WidgetCard/styles';
import { Button } from 'container/MetricsApplication/Tabs/styles';
@@ -28,7 +29,10 @@ import {
getFiltersFromQueryParams,
} from '../CeleryUtils';
import { useNavigateToExplorer } from '../useNavigateToExplorer';
import { celeryTaskLatencyWidgetData } from './CeleryTaskGraphUtils';
import {
celeryTaskLatencyWidgetData,
getClickedSeries,
} from './CeleryTaskGraphUtils';
import './CeleryTaskGraph.style.scss';
@@ -129,13 +133,12 @@ function CeleryTaskLatencyGraph({
const onGraphClick = useCallback(
(type: string): OnClickPluginOpts['onClick'] =>
(xValue, yValue, mouseX, mouseY, data): Promise<void> => {
const [firstDataPoint] = Object.entries(data || {});
const [entity, value] = firstDataPoint;
setEntityData({
entity,
value,
});
(xValue, yValue, mouseX, mouseY, data, queryData): Promise<void> => {
const clickedSeries = getClickedSeries(data, queryData);
if (!clickedSeries) {
return Promise.resolve();
}
setEntityData(clickedSeries);
return onGraphClickHandler(xValue, yValue, mouseX, mouseY, type);
},
@@ -199,6 +202,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p99_latency')}
@@ -220,6 +224,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p95_latency')}
@@ -240,6 +245,7 @@ function CeleryTaskLatencyGraph({
</Button>
<GridCard
widget={updatedWidgetData}
version={ENTITY_VERSION_V5}
headerMenuList={[...ViewMenuAction]}
onDragSelect={onDragSelect}
onClickHandler={onGraphClick('Celery_p90_latency')}

View File

@@ -90,7 +90,10 @@ function CeleryTaskStateGraphConfig({
>
<div className="celery-task-states__label-wrapper">
<div className="celery-task-states__label">{tab.label}</div>
<div className="celery-task-states__value">
<div
className="celery-task-states__value"
data-testid={`celery-state-value-${tab.key}`}
>
{isLoading
? '-'
: isError

View File

@@ -61,7 +61,13 @@ describe('CeleryTaskGraphGrid worker count', () => {
);
const { minTime, maxTime } = store.getState().globalTime;
expect(requests).toStrictEqual([
expect(
requests.filter((request) =>
request.compositeQuery?.queries?.some(
(query) => (query.spec as { signal?: string }).signal === 'metrics',
),
),
).toStrictEqual([
{
schemaVersion: 'v1',
start: Math.floor(minTime / 1e6),

View File

@@ -0,0 +1,92 @@
import {
Querybuildertypesv5ColumnTypeDTO,
Querybuildertypesv5QueryEnvelopeBuilderDTOType,
type Querybuildertypesv5QueryRangeRequestDTO,
Querybuildertypesv5RequestTypeDTO,
type QueryRangeV5200,
} from 'api/generated/services/sigNoz.schemas';
import { rest, server } from 'mocks-server/server';
import { render, screen, waitFor } from 'tests/test-utils';
import {
CeleryTaskState,
CeleryTaskStateGraphConfig,
} from '../CeleryTaskStateGraphConfig';
const COUNT_PER_STATE: Record<string, number> = {
FAILURE: 12,
RETRY: 30,
SUCCESS: 958,
};
const stateOf = (body: Querybuildertypesv5QueryRangeRequestDTO): string => {
const [envelope] = body.compositeQuery?.queries ?? [];
const expression =
envelope?.type ===
Querybuildertypesv5QueryEnvelopeBuilderDTOType.builder_query
? (envelope.spec?.filter?.expression ?? '')
: '';
return /celery\.state = '(\w+)'/.exec(expression)?.[1] ?? '';
};
const scalarResponse = (value: number): QueryRangeV5200 => ({
status: 'success',
data: {
type: Querybuildertypesv5RequestTypeDTO.scalar,
data: {
results: [
{
columns: [
{
name: '__result_0',
queryName: 'A',
aggregationIndex: 0,
columnType: Querybuildertypesv5ColumnTypeDTO.aggregation,
},
],
data: [[value]],
},
],
},
},
});
describe('CeleryTaskStateGraphConfig', () => {
beforeEach(() => {
server.use(
rest.post('*/api/v5/query_range', async (req, res, ctx) => {
const body: Querybuildertypesv5QueryRangeRequestDTO = await req.json();
return res(
ctx.status(200),
ctx.json(scalarResponse(COUNT_PER_STATE[stateOf(body)] ?? 1000)),
);
}),
);
});
it('shows the v5 count for each task state', async () => {
render(
<CeleryTaskStateGraphConfig
barState={CeleryTaskState.All}
setBarState={jest.fn()}
/>,
);
await waitFor(() =>
expect(screen.getByTestId('celery-state-value-all')).toHaveTextContent(
'1000',
),
);
expect(screen.getByTestId('celery-state-value-failed')).toHaveTextContent(
'12',
);
expect(screen.getByTestId('celery-state-value-retry')).toHaveTextContent(
'30',
);
expect(screen.getByTestId('celery-state-value-successful')).toHaveTextContent(
'958',
);
});
});

View File

@@ -0,0 +1,136 @@
import { prepareQueryRangePayloadV5 } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { celeryOverviewErrorRateGraphData } from 'pages/Celery/CeleryOverview/CeleryOverviewGraphUtils';
import { Widgets } from 'types/api/widgets/widget';
import {
celeryAllStateWidgetData,
celeryErrorByWorkerWidgetData,
celeryLatencyByWorkerWidgetData,
celerySlowestTasksTableWidgetData,
celeryTaskLatencyWidgetData,
celeryTasksByWorkerWidgetData,
} from '../CeleryTaskGraphUtils';
const START = 1_700_000_000_000_000_000;
const END = START + 3_600_000_000_000;
const v5Queries = (
widget: Widgets,
): ReturnType<
typeof prepareQueryRangePayloadV5
>['queryPayload']['compositeQuery']['queries'] =>
prepareQueryRangePayloadV5({
query: widget.query,
graphType: PANEL_TYPES.TIME_SERIES,
selectedTime: 'GLOBAL_TIME',
start: 1_700_000_000,
end: 1_700_003_600,
}).queryPayload.compositeQuery.queries;
const builderQuery = (
name: string,
expression: string,
): ReturnType<typeof expect.objectContaining> =>
expect.objectContaining({
type: 'builder_query',
spec: expect.objectContaining({
name,
signal: 'traces',
aggregations: [{ expression }],
}),
});
const formula = (
name: string,
expression: string,
): ReturnType<typeof expect.objectContaining> =>
expect.objectContaining({
type: 'builder_formula',
spec: expect.objectContaining({ name, expression }),
});
describe('Celery widgets on query_range v5', () => {
it.each([
['tasks by worker', celeryTasksByWorkerWidgetData(START, END), 'rate()'],
[
'latency by worker',
celeryLatencyByWorkerWidgetData(START, END),
'p99(duration_nano)',
],
[
'task latency tab',
celeryTaskLatencyWidgetData('p95', START, END),
'p95(duration_nano)',
],
])('%s sends its own aggregation', (_name, widget, expression) => {
expect(v5Queries(widget)).toStrictEqual([builderQuery('A', expression)]);
});
it.each([
[
'task latency tab',
celeryTaskLatencyWidgetData('p95', START, END),
'p95(duration_nano)',
'asc',
],
[
'slowest tasks table',
celerySlowestTasksTableWidgetData,
'avg(duration_nano)',
'desc',
],
])('%s orders by its aggregation', (_name, widget, name, direction) => {
expect(v5Queries(widget)).toStrictEqual([
expect.objectContaining({
spec: expect.objectContaining({
order: [{ key: { name }, direction }],
}),
}),
]);
});
it.each([
[
'all states bar',
celeryAllStateWidgetData(START, END),
'celery.state exists',
],
[
'tasks by worker',
celeryTasksByWorkerWidgetData(START, END),
'celery.hostname exists',
],
[
'task latency tab',
celeryTaskLatencyWidgetData('p95', START, END),
'celery.task_name exists',
],
])('%s drops spans without its group-by key', (_name, widget, expression) => {
expect(v5Queries(widget)).toStrictEqual([
expect.objectContaining({
spec: expect.objectContaining({ filter: { expression } }),
}),
]);
});
it('error % by worker sends its formula as a formula', () => {
expect(v5Queries(celeryErrorByWorkerWidgetData(START, END))).toStrictEqual([
builderQuery('A', 'count_distinct(span_id)'),
builderQuery('B', 'count_distinct(span_id)'),
formula('F1', '(A/B)*100'),
]);
});
it('overview error rate sends both formulas as formulas', () => {
expect(v5Queries(celeryOverviewErrorRateGraphData(START, END))).toStrictEqual(
[
builderQuery('A', 'count_distinct(span_id)'),
builderQuery('B', 'count_distinct(span_id)'),
builderQuery('C', 'count_distinct(span_id)'),
formula('F1', '(A/C)*100'),
formula('F2', '(B/C)*100'),
],
);
});
});

View File

@@ -0,0 +1,27 @@
import { getClickedSeries } from '../CeleryTaskGraphUtils';
const focused = { queryName: 'A', inFocusOrNot: true };
const unfocused = { queryName: '', inFocusOrNot: false };
describe('getClickedSeries', () => {
it('returns the clicked series label', () => {
expect(
getClickedSeries(
{ 'celery.state': 'RETRY', clickedTimestamp: '1700000000' },
focused,
),
).toStrictEqual({ entity: 'celery.state', value: 'RETRY' });
});
it('ignores a click outside any series', () => {
expect(
getClickedSeries({ clickedTimestamp: '1700000000' }, unfocused),
).toBeUndefined();
});
it('ignores a series that has no label', () => {
expect(
getClickedSeries({ clickedTimestamp: '1700000000' }, focused),
).toBeUndefined();
});
});

View File

@@ -2,10 +2,13 @@ import { useCallback } from 'react';
import { useQueries } from 'react-query';
// eslint-disable-next-line no-restricted-imports
import { useSelector } from 'react-redux';
import { ENTITY_VERSION_V4 } from 'constants/app';
import { ENTITY_VERSION_V5 } from 'constants/app';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
import { getQueryPayloadFromWidgetsData } from 'pages/Celery/CeleryOverview/CeleryOverviewUtils';
import {
getQueryPayloadFromWidgetsData,
getValueFromScalarResponse,
} from 'pages/Celery/CeleryOverview/CeleryOverviewUtils';
import { AppState } from 'store/reducers';
import { SuccessResponse } from 'types/api';
import { Widgets } from 'types/api/widgets/widget';
@@ -39,9 +42,9 @@ export const useGetValueFromWidget = (
const queries = useQueries(
queryPayloads().map((payload) => ({
queryKey: [...queryKey, payload, ENTITY_VERSION_V4],
queryKey: [...queryKey, payload, ENTITY_VERSION_V5],
queryFn: (): Promise<SuccessResponse<MetricRangePayloadProps>> =>
GetMetricQueryRange(payload, ENTITY_VERSION_V4),
GetMetricQueryRange(payload, ENTITY_VERSION_V5),
enabled: !!payload,
})),
);
@@ -57,11 +60,7 @@ export const useGetValueFromWidget = (
return 'Error';
}
const value = parseFloat(
query.data?.payload?.data?.newResult?.data?.result?.[0]?.series?.[0]
?.values?.[0]?.value || 'NaN',
);
return Number.isNaN(value) ? 'NaN' : value.toFixed(2);
return getValueFromScalarResponse(query.data);
});
return { values, isLoading, isError };

View File

@@ -11,9 +11,7 @@
justify-content: center;
}
&__label {
font-family: 'Geist Mono';
font-size: 12px;
line-height: normal;
font-family: var(--code-base-400-font-family);
}
&--positive {
.change-percentage-pill {

View File

@@ -98,6 +98,10 @@ function ChangelogModal({ changelog, onClose }: Props): JSX.Element {
}
};
// TODO: antd stacks at 1000, under `@signozhq/ui` dialogs (1001). It opens on
// its own a second after load, so a dialog opened from a deep link
// (`?add-key`, `?invite=true`) covers it. Moving to the `@signozhq/ui` Dialog
// fixes it.
return (
<Modal
className={cx('changelog-modal')}

View File

@@ -17,10 +17,6 @@
color: var(--l2-foreground);
/* Bifrost (Ancient)/Content/sm */
font-family: Inter;
font-size: 13px;
font-style: normal;
font-weight: 400;
line-height: 20px; /* 142.857% */
letter-spacing: -0.07px;

View File

@@ -17,13 +17,13 @@
pre {
color: var(--l2-foreground) !important;
font-family: 'Geist Mono' !important;
font-family: var(--code-small-400-font-family) !important;
font-size: 12px !important;
}
code {
color: var(--l1-foreground) !important;
font-family: 'Geist Mono' !important;
font-family: var(--code-small-400-font-family) !important;
font-size: 12px !important;
}
}

View File

@@ -1,36 +1,3 @@
.create-sa-modal {
max-width: 530px;
background: var(--popover);
border: 1px solid var(--secondary);
border-radius: 4px;
box-shadow: 0 4px 9px 0 rgba(0, 0, 0, 0.04);
[data-slot='dialog-header'] {
padding: var(--padding-4);
border-bottom: 1px solid var(--secondary);
flex-shrink: 0;
background: transparent;
margin: 0;
}
[data-slot='dialog-title'] {
font-size: var(--label-base-400-font-size);
font-weight: var(--label-base-400-font-weight);
line-height: var(--label-base-400-line-height);
letter-spacing: -0.065px;
color: var(--l1-foreground);
margin: 0;
}
[data-slot='dialog-description'] {
padding: 0;
.create-sa-modal__content {
padding: var(--padding-4);
}
}
}
.create-sa-form {
display: flex;
flex-direction: column;
@@ -43,32 +10,11 @@
margin-bottom: var(--spacing-4);
> label {
font-size: var(--paragraph-base-400-font-size);
font-weight: var(--paragraph-base-400-font-weight);
color: var(--foreground);
letter-spacing: -0.07px;
}
}
&__input {
height: 32px;
color: var(--l1-foreground);
background-color: var(--l2-background);
border-color: var(--l1-border);
font-size: var(--paragraph-base-400-font-size);
border-radius: 2px;
width: 100%;
&::placeholder {
color: var(--l3-foreground);
}
&:focus {
border-color: var(--primary);
box-shadow: none;
}
}
&__error {
font-size: var(--paragraph-small-400-font-size);
color: var(--destructive);
@@ -77,22 +23,7 @@
}
&__helper {
font-size: var(--paragraph-small-400-font-size);
color: var(--l3-foreground);
margin: calc(var(--spacing-2) * -1) 0 var(--spacing-4) 0;
line-height: var(--paragraph-small-400-line-height);
}
}
.create-sa-modal__footer {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
padding: 0 var(--padding-4);
height: 56px;
min-height: 56px;
border-top: 1px solid var(--secondary);
gap: var(--spacing-4);
flex-shrink: 0;
}

View File

@@ -5,9 +5,9 @@ import { Button } from '@signozhq/ui/button';
import AuthZButton from 'lib/authz/components/AuthZButton/AuthZButton';
import { AuthZGuardContent } from 'lib/authz/components/AuthZGuard/AuthZGuardContent';
import { SACreatePermission } from 'lib/authz/hooks/useAuthZ/permissions/service-account.permissions';
import { DialogFooter, DialogWrapper } from '@signozhq/ui/dialog';
import { Dialog } from '@signozhq/ui/dialog';
import { Input } from '@signozhq/ui/input';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { convertToApiError } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import {
invalidateListServiceAccounts,
@@ -35,7 +35,7 @@ function CreateServiceAccountModal(): JSX.Element {
);
const [, setSelectedAccountId] = useQueryState(SA_QUERY_PARAMS.ACCOUNT);
const { showErrorModal, isErrorModalVisible } = useErrorModal();
const { showErrorModal } = useErrorModal();
const {
control,
@@ -82,84 +82,75 @@ function CreateServiceAccountModal(): JSX.Element {
}
return (
<DialogWrapper
<Dialog
title="New Service Account"
open={isOpen}
onOpenChange={(open): void => {
if (!open) {
handleClose();
}
}}
showCloseButton
width="narrow"
className="create-sa-modal"
disableOutsideClick={isErrorModalVisible}
onClose={handleClose}
width="base"
testId="create-service-account-modal"
>
<div className="create-sa-modal__content">
<AuthZGuardContent
checks={[SACreatePermission]}
fallbackOnLoading={<Skeleton active paragraph={{ rows: 1 }} />}
>
<form
id="create-sa-form"
className="create-sa-form"
onSubmit={handleSubmit(handleCreate)}
footerSuffix={
<>
<Button
size="md"
type="button"
variant="solid"
color="secondary"
onClick={handleClose}
testId="create-sa-cancel-btn"
prefix={<X size={12} />}
>
<div className="create-sa-form__item">
<label htmlFor="sa-name">Name</label>
<Controller
name="name"
control={control}
rules={{ required: 'Name is required' }}
render={({ field }): JSX.Element => (
<Input
id="sa-name"
placeholder="Enter a name"
className="create-sa-form__input"
value={field.value}
onChange={field.onChange}
onBlur={field.onBlur}
data-testid="create-sa-name-input"
/>
)}
/>
{errors.name && (
<p className="create-sa-form__error">{errors.name.message}</p>
Cancel
</Button>
<AuthZButton
size="md"
checks={[SACreatePermission]}
type="submit"
form="create-sa-form"
variant="solid"
color="primary"
loading={isSubmitting}
disabled={!isValid}
testId="create-sa-submit-btn"
>
Create Service Account
</AuthZButton>
</>
}
>
<AuthZGuardContent
checks={[SACreatePermission]}
fallbackOnLoading={<Skeleton active paragraph={{ rows: 1 }} />}
>
<form
id="create-sa-form"
className="create-sa-form"
onSubmit={handleSubmit(handleCreate)}
>
<div className="create-sa-form__item">
<label htmlFor="sa-name">Name</label>
<Controller
name="name"
control={control}
rules={{ required: 'Name is required' }}
render={({ field }): JSX.Element => (
<Input
id="sa-name"
placeholder="Enter a name"
value={field.value}
onChange={field.onChange}
onBlur={field.onBlur}
testId="create-sa-name-input"
/>
)}
</div>
</form>
</AuthZGuardContent>
</div>
<DialogFooter className="create-sa-modal__footer">
<Button
size="md"
type="button"
variant="solid"
color="secondary"
onClick={handleClose}
testId="create-sa-cancel-btn"
prefix={<X size={12} />}
>
Cancel
</Button>
<AuthZButton
size="md"
checks={[SACreatePermission]}
type="submit"
form="create-sa-form"
variant="solid"
color="primary"
loading={isSubmitting}
disabled={!isValid}
testId="create-sa-submit-btn"
>
Create Service Account
</AuthZButton>
</DialogFooter>
</DialogWrapper>
/>
{errors.name && (
<p className="create-sa-form__error">{errors.name.message}</p>
)}
</div>
</form>
</AuthZGuardContent>
</Dialog>
);
}

View File

@@ -1,4 +1,4 @@
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import {
setupAuthzAdmin,
setupAuthzDenyAll,
@@ -10,9 +10,9 @@ import { render, screen, userEvent, waitFor } from 'tests/test-utils';
import CreateServiceAccountModal from '../CreateServiceAccountModal';
jest.mock('@signozhq/ui/sonner', () => ({
...jest.requireActual('@signozhq/ui/sonner'),
toast: { success: jest.fn(), error: jest.fn() },
jest.mock('@signozhq/ui/toast', () => ({
...jest.requireActual('@signozhq/ui/toast'),
toast: { success: jest.fn(), danger: jest.fn() },
}));
const mockToast = jest.mocked(toast);
@@ -23,7 +23,6 @@ jest.mock('providers/ErrorModalProvider', () => ({
...jest.requireActual('providers/ErrorModalProvider'),
useErrorModal: jest.fn(() => ({
showErrorModal,
isErrorModalVisible: false,
})),
}));
@@ -58,7 +57,7 @@ describe('CreateServiceAccountModal', () => {
// The form only renders once the create check resolves, and the name field
// registers its `required` rule on mount, so the empty-form invalid state
// settles a tick later.
await screen.findByTestId('create-sa-name-input');
await screen.findByTestId('create-sa-name-input-field');
await waitFor(() =>
expect(screen.getByTestId('create-sa-submit-btn')).toHaveAttribute(
@@ -72,7 +71,7 @@ describe('CreateServiceAccountModal', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderModal();
const nameInput = await screen.findByTestId('create-sa-name-input');
const nameInput = await screen.findByTestId('create-sa-name-input-field');
const submitBtn = await screen.findByTestId('create-sa-submit-btn');
await user.type(nameInput, 'test');
@@ -90,7 +89,7 @@ describe('CreateServiceAccountModal', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderModal();
const nameInput = await screen.findByTestId('create-sa-name-input');
const nameInput = await screen.findByTestId('create-sa-name-input-field');
await user.type(nameInput, 'Deploy Bot');
const submitBtn = screen.getByTestId('create-sa-submit-btn');
@@ -128,7 +127,7 @@ describe('CreateServiceAccountModal', () => {
renderModal();
const nameInput = await screen.findByTestId<HTMLInputElement>(
'create-sa-name-input',
'create-sa-name-input-field',
);
await user.type(nameInput, 'Deploy Bot');
const submitBtn = screen.getByTestId('create-sa-submit-btn');
@@ -160,7 +159,7 @@ describe('CreateServiceAccountModal', () => {
renderModal();
const nameInput = await screen.findByTestId('create-sa-name-input');
const nameInput = await screen.findByTestId('create-sa-name-input-field');
await user.type(nameInput, 'Dupe Bot');
const submitBtn = screen.getByTestId('create-sa-submit-btn');
@@ -209,7 +208,9 @@ describe('CreateServiceAccountModal', () => {
screen.findByText(/is not authorized to perform/i),
).resolves.toBeInTheDocument();
expect(screen.queryByTestId('create-sa-name-input')).not.toBeInTheDocument();
expect(
screen.queryByTestId('create-sa-name-input-field'),
).not.toBeInTheDocument();
expect(
screen.getByTestId('create-service-account-modal'),
).toBeInTheDocument();
@@ -244,7 +245,7 @@ describe('CreateServiceAccountModal', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
renderModal();
const nameInput = await screen.findByTestId('create-sa-name-input');
const nameInput = await screen.findByTestId('create-sa-name-input-field');
await user.type(nameInput, 'Bot');
await user.clear(nameInput);

View File

@@ -65,8 +65,6 @@
.valid-format-error {
margin-top: 4px;
color: var(--bg-cherry-400) !important;
font-size: 13px !important;
font-weight: 400 !important;
}
.info-text {
@@ -76,11 +74,6 @@
padding: 4px;
cursor: default;
color: var(--l2-foreground) !important;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: normal;
letter-spacing: 0.14px;
}
.info-text:hover {
@@ -104,15 +97,11 @@
gap: 6px;
.timezone__name {
font-size: 12px;
line-height: 16px;
color: var(--bg-robin-400);
font-weight: 500;
}
.timezone__separator {
font-size: 12px;
line-height: 16px;
color: var(--bg-robin-300);
font-weight: 500;
}
@@ -228,10 +217,6 @@
border-radius: 2px;
background: color-mix(in srgb, var(--bg-robin-200) 4%, transparent);
color: var(--l1-foreground);
font-size: 12px;
font-weight: 400;
line-height: 16px;
letter-spacing: -0.06px;
cursor: pointer;
height: 20px;
width: 20px;

View File

@@ -531,7 +531,7 @@ function CustomTimePicker({
// Use setTimeout to wait for React to update the DOM and make input editable
setTimeout(() => {
const inputElement = inputRef.current?.input;
if (inputElement) {
if (inputElement && !document.activeElement?.closest('.timezone-picker')) {
inputElement.focus();
inputElement.select();
}

View File

@@ -21,7 +21,6 @@ $item-spacing: 8px;
.timezone-picker {
width: 532px;
color: var(--l2-foreground);
font-family: $font-family;
&__search {
@include flex-center;
@@ -34,34 +33,8 @@ $item-spacing: 8px;
@include flex-center;
gap: 6px;
width: -webkit-fill-available;
}
&__input {
@include text-style-base;
width: 100%;
background: transparent;
border: none;
border-radius: 0;
box-shadow: none;
outline: none;
height: auto;
color: var(--l1-foreground);
font-size: 14px;
line-height: 20px;
letter-spacing: -0.07px;
padding: 0;
&:focus,
&:focus-visible,
&:hover {
border: none;
box-shadow: none;
outline: none;
}
&::placeholder {
color: var(--l2-foreground);
}
--input-hover-border-color: transparent;
}
&__esc-key {

View File

@@ -65,7 +65,8 @@ function SearchBar({
/>
<Input
type="text"
className="timezone-picker__input"
variant="unstyled"
noFocusRing
placeholder="Search timezones..."
value={value}
onChange={(e): void => onChange(e.target.value)}

View File

@@ -12,5 +12,4 @@
.name {
color: var(--danger-background);
font-weight: var(--font-weight-medium);
}

View File

@@ -1,7 +1,4 @@
.details-header {
// ghost + secondary missing hover bg token in @signozhq/button
--button-ghost-hover-background: var(--l3-background);
box-sizing: border-box;
display: flex;
align-items: center;
@@ -12,7 +9,6 @@
background: var(--l2-background);
&__title {
font-size: 13px;
font-weight: 500;
color: var(--l1-foreground);
flex: 1;

View File

@@ -1,17 +0,0 @@
.drawer {
overflow: hidden;
border-color: var(--l2-border);
background: var(--l2-background);
box-shadow: -4px 10px 16px 2px var(--l1-shadow);
&:focus,
&:focus-visible {
outline: none;
}
}
.body {
display: flex;
flex-direction: column;
height: 100%;
}

View File

@@ -1,56 +1,46 @@
import { Drawer, DrawerContent } from '@signozhq/ui/drawer';
import cx from 'classnames';
import { AnimatePresence } from 'motion/react';
import styles from './DetailsPanelDrawer.module.scss';
import { ReactNode } from 'react';
import { Drawer } from '@signozhq/ui/drawer';
interface DetailsPanelDrawerProps {
isOpen: boolean;
onClose: () => void;
children: React.ReactNode;
className?: string;
title: string;
children: ReactNode;
headerSuffix?: ReactNode;
loading?: boolean;
testId?: string;
}
function DetailsPanelDrawer({
isOpen,
onClose,
title,
children,
className,
headerSuffix,
loading,
testId,
}: DetailsPanelDrawerProps): JSX.Element {
return (
<Drawer
type="inspector"
stack="overlay"
open={isOpen}
onOpenChange={(open): void => {
if (!open) {
onClose();
}
}}
modal={false}
onClose={onClose}
title={title}
width="extra-wide"
closePosition="start"
headerSuffix={headerSuffix}
loading={loading}
testId={testId}
>
<AnimatePresence>
{isOpen && (
<DrawerContent
forceMount
direction="right"
width="extra-wide"
showOverlay={false}
// Outside presses are left to the page, which knows what counts as inside.
onInteractOutside={(e): void => e.preventDefault()}
className={cx(styles.drawer, className)}
testId={testId}
>
<div className={styles.body}>{children}</div>
</DrawerContent>
)}
</AnimatePresence>
{children}
</Drawer>
);
}
DetailsPanelDrawer.defaultProps = {
className: undefined,
headerSuffix: undefined,
loading: false,
testId: undefined,
};

View File

@@ -17,8 +17,8 @@
position: absolute;
left: var(--spacing-6);
bottom: var(--spacing-1);
font-family: var(--font-mono, monospace);
font-size: var(--periscope-font-size-small);
font-family: var(--code-small-400-font-family);
font-size: var(--paragraph-small-400-font-size);
letter-spacing: 0.34em;
text-transform: uppercase;
white-space: nowrap;

View File

@@ -68,7 +68,17 @@ export default function DownloadOptionsMenu({
aria-modal="true"
>
<div className="export-format">
<Typography.Text className="title">FORMAT</Typography.Text>
<Typography
variant="uppercase"
size="small"
weight="medium"
color="main"
as="p"
marginBottom={4}
textOverflow="wrap"
>
FORMAT
</Typography>
<RadioGroup
color="primary"
value={exportFormat}
@@ -83,7 +93,17 @@ export default function DownloadOptionsMenu({
<div className="horizontal-line" />
<div className="row-limit">
<Typography.Text className="title">Number of Rows</Typography.Text>
<Typography
variant="uppercase"
size="small"
weight="medium"
color="main"
as="p"
marginBottom={4}
textOverflow="wrap"
>
Number of Rows
</Typography>
<RadioGroup
color="primary"
value={String(rowLimit)}
@@ -101,7 +121,17 @@ export default function DownloadOptionsMenu({
<div className="horizontal-line" />
<div className="columns-scope">
<Typography.Text className="title">Columns</Typography.Text>
<Typography
variant="uppercase"
size="small"
weight="medium"
color="main"
as="p"
marginBottom={4}
textOverflow="wrap"
>
Columns
</Typography>
<RadioGroup
color="primary"
value={columnsScope}

View File

@@ -1,6 +1,5 @@
import { Trash2, X } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { DialogWrapper } from '@signozhq/ui/dialog';
import { AlertDialog } from '@signozhq/ui/alert-dialog';
import { MemberRow } from 'components/MembersTable/MembersTable';
interface DeleteMemberDialogProps {
@@ -9,7 +8,7 @@ interface DeleteMemberDialogProps {
member: MemberRow | null;
isDeleting: boolean;
onClose: () => void;
onConfirm: () => void;
onConfirm: () => Promise<void>;
}
function DeleteMemberDialog({
@@ -36,47 +35,20 @@ function DeleteMemberDialog({
</>
);
const footer = (
<>
<Button
size="md"
variant="solid"
color="secondary"
onClick={onClose}
prefix={<X size={12} />}
>
Cancel
</Button>
<Button
size="md"
variant="solid"
color="danger"
onClick={onConfirm}
testId="member-delete-confirm-btn"
loading={isDeleting}
prefix={<Trash2 size={12} />}
>
{isDeleting ? 'Processing...' : title}
</Button>
</>
);
return (
<DialogWrapper
<AlertDialog
open={open}
onOpenChange={(isOpen): void => {
if (!isOpen) {
onClose();
}
}}
title={title}
width="narrow"
showCloseButton={false}
disableOutsideClick={false}
footer={footer}
color="danger"
confirmText={isDeleting ? 'Processing...' : title}
confirmIcon={<Trash2 size={12} />}
cancelIcon={<X size={12} />}
onConfirm={onConfirm}
onCancel={onClose}
testId="member-delete"
>
{body}
</DialogWrapper>
</AlertDialog>
);
}

View File

@@ -20,10 +20,9 @@
}
&__label {
font-size: var(--font-size-sm);
font-weight: var(--font-weight-normal);
font-size: var(--paragraph-base-400-font-size);
color: var(--foreground);
line-height: var(--line-height-20);
line-height: var(--paragraph-base-400-line-height);
letter-spacing: -0.07px;
cursor: default;
}
@@ -53,10 +52,8 @@
}
&__email-text {
font-size: var(--paragraph-base-400-font-size);
font-weight: var(--paragraph-base-400-font-weight);
color: var(--foreground);
line-height: var(--line-height-18);
line-height: var(--paragraph-small-400-line-height);
letter-spacing: -0.07px;
white-space: nowrap;
overflow: hidden;
@@ -86,41 +83,26 @@
[data-slot='badge'] {
padding: var(--padding-1) var(--padding-2);
align-items: center;
font-size: var(--uppercase-small-500-font-size);
font-weight: var(--uppercase-small-500-font-weight);
line-height: 100%;
letter-spacing: 0.44px;
}
}
&__meta-label {
font-size: var(--font-size-xs);
font-weight: var(--font-weight-medium);
font-size: var(--uppercase-small-500-font-size);
font-weight: var(--uppercase-small-500-font-weight);
color: var(--foreground);
line-height: var(--line-height-20);
line-height: var(--uppercase-small-500-line-height);
letter-spacing: 0.48px;
text-transform: uppercase;
}
&__footer {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
&__footer-left {
display: flex;
align-items: center;
gap: var(--spacing-4);
}
&__footer-right {
display: flex;
align-items: center;
gap: var(--spacing-6);
}
&__footer-divider {
width: 1px;
height: 21px;
@@ -163,14 +145,6 @@
}
.reset-link-dialog {
background: var(--l2-background);
border: 1px solid var(--l1-border);
[data-slot='dialog-header'] {
border-color: var(--l1-border);
color: var(--l1-foreground);
}
&__content {
display: flex;
flex-direction: column;
@@ -178,8 +152,6 @@
}
&__description {
font-size: var(--paragraph-base-400-font-size);
font-weight: var(--paragraph-base-400-font-weight);
color: var(--l2-foreground);
line-height: var(--paragraph-base-400-line-height);
letter-spacing: -0.065px;
@@ -193,8 +165,8 @@
align-items: center;
height: 32px;
overflow: hidden;
background: var(--l2-background);
border: 1px solid var(--l1-border);
background: var(--l3-background);
border: 1px solid var(--l3-border);
border-radius: 2px;
padding-right: var(--spacing-4);
}
@@ -211,10 +183,8 @@
overflow: hidden;
text-overflow: ellipsis;
padding: 0 var(--padding-2);
font-size: var(--paragraph-base-400-font-size);
font-weight: var(--paragraph-base-400-font-weight);
color: var(--l2-foreground);
line-height: var(--line-height-18);
line-height: var(--paragraph-small-400-line-height);
letter-spacing: -0.07px;
}
}

View File

@@ -3,9 +3,9 @@ import { useCopyToClipboard } from 'react-use';
import { LockKeyhole, RefreshCw, Trash2, X } from '@signozhq/icons';
import { Badge } from '@signozhq/ui/badge';
import { Button } from '@signozhq/ui/button';
import { DrawerWrapper } from '@signozhq/ui/drawer';
import { Drawer } from '@signozhq/ui/drawer';
import { Input } from '@signozhq/ui/input';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { Skeleton, Tooltip } from 'antd';
import { convertToApiError } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import type { RenderErrorResponseDTO } from 'api/generated/services/sigNoz.schemas';
@@ -258,7 +258,7 @@ function EditMemberDrawer({
const { mutateAsync: updateMyUser } = useUpdateMyUserV2();
const { mutateAsync: updateUser } = useUpdateUser();
const { mutate: deleteUser, isLoading: isDeleting } = useDeleteUser({
const { mutateAsync: deleteUser, isLoading: isDeleting } = useDeleteUser({
mutation: {
onSuccess: (): void => {
toast.success(
@@ -426,11 +426,15 @@ function EditMemberDrawer({
onComplete,
]);
const handleDelete = useCallback((): void => {
const handleDelete = useCallback(async (): Promise<void> => {
if (!member) {
return;
}
deleteUser({ pathParams: { id: member.id } });
try {
await deleteUser({ pathParams: { id: member.id } });
} catch {
// `onError` already shows the error modal, and the confirmation stays open.
}
}, [member, deleteUser]);
const handleGenerateResetLink = useCallback(async (): Promise<void> => {
@@ -457,7 +461,8 @@ function EditMemberDrawer({
setShowResetLinkDialog(true);
onClose();
} else {
toast.error('Failed to generate password reset link', {
toast.danger('Failed to generate password reset link', {
action: { label: 'Dismiss' },
position: 'top-right',
});
}
@@ -486,7 +491,7 @@ function EditMemberDrawer({
useEffect(() => {
if (copyState.error) {
toast.error('Failed to copy link');
toast.danger('Failed to copy link', { action: { label: 'Dismiss' } });
}
}, [copyState.error]);
@@ -560,6 +565,7 @@ function EditMemberDrawer({
}}
placeholder="Enter name"
disabled={isRootUser || isDeleted}
disabledTooltip={undefined}
/>
</AuthZTooltip>
</div>
@@ -612,6 +618,7 @@ function EditMemberDrawer({
<RolesSelect
id="member-role"
mode="multiple"
testId="member-roles-select"
roles={availableRoles}
loading={rolesLoading}
isError={rolesError}
@@ -687,91 +694,83 @@ function EditMemberDrawer({
</div>
);
const footer = (
<div className="edit-member-drawer__footer">
{!isDeleted && (
<>
<div className="edit-member-drawer__footer-left">
<AuthZButton
disabledTooltip={getDeleteTooltip(isRootUser, isSelf)}
size="md"
onClick={(): void => setShowDeleteConfirm(true)}
testId="member-delete-btn"
variant="link"
color="danger"
checks={member ? [buildUserDeletePermission(member.id)] : []}
prefix={<Trash2 size={12} />}
>
{isInvited ? 'Revoke Invite' : 'Delete Member'}
</AuthZButton>
const footerStart = isDeleted ? null : (
<div className="edit-member-drawer__footer-left">
<AuthZButton
disabledTooltip={getDeleteTooltip(isRootUser, isSelf)}
size="md"
onClick={(): void => setShowDeleteConfirm(true)}
testId="member-delete-btn"
variant="link"
color="danger"
checks={member ? [buildUserDeletePermission(member.id)] : []}
prefix={<Trash2 size={12} />}
>
{isInvited ? 'Revoke Invite' : 'Delete Member'}
</AuthZButton>
<div className="edit-member-drawer__footer-divider" />
<AuthZButton
disabledTooltip={isRootUser ? ROOT_USER_TOOLTIP : undefined}
size="md"
onClick={handleGenerateResetLink}
testId="member-reset-link-btn"
loading={isGeneratingLink || isLoadingTokenStatus}
variant="link"
color="warning"
checks={resetLinkChecks}
prefix={<RefreshCw size={12} />}
>
{inviteLinkAndResetPasswordText}
</AuthZButton>
</div>
<div className="edit-member-drawer__footer-right">
<Button
size="md"
variant="outlined"
color="secondary"
onClick={handleClose}
prefix={<X size={14} />}
>
Cancel
</Button>
<AuthZButton
disabledTooltip={
isRootUser
? ROOT_USER_TOOLTIP
: !isDirty
? 'No changes to save'
: undefined
}
size="md"
variant="solid"
color="primary"
disabled={!isDirty || isRootUser}
onClick={handleSave}
checks={[]}
testId="member-save-btn"
loading={isSaving}
>
{isSaving ? 'Saving...' : 'Save Member Details'}
</AuthZButton>
</div>
</>
)}
<div className="edit-member-drawer__footer-divider" />
<AuthZButton
disabledTooltip={isRootUser ? ROOT_USER_TOOLTIP : undefined}
size="md"
onClick={handleGenerateResetLink}
testId="member-reset-link-btn"
loading={isGeneratingLink || isLoadingTokenStatus}
variant="link"
color="warning"
checks={resetLinkChecks}
prefix={<RefreshCw size={12} />}
>
{inviteLinkAndResetPasswordText}
</AuthZButton>
</div>
);
const footerActions = isDeleted ? null : (
<>
<Button
size="md"
variant="outlined"
color="secondary"
onClick={handleClose}
prefix={<X size={14} />}
>
Cancel
</Button>
<AuthZButton
disabledTooltip={
isRootUser
? ROOT_USER_TOOLTIP
: !isDirty
? 'No changes to save'
: undefined
}
size="md"
variant="solid"
color="primary"
disabled={!isDirty || isRootUser}
onClick={handleSave}
checks={[]}
testId="member-save-btn"
loading={isSaving}
>
{isSaving ? 'Saving...' : 'Save Member Details'}
</AuthZButton>
</>
);
return (
<>
<DrawerWrapper
<Drawer
type="task"
stack="overlay"
open={member !== null}
onOpenChange={(isOpen): void => {
if (!isOpen) {
handleClose();
}
}}
direction="right"
showCloseButton
showOverlay={false}
onClose={handleClose}
title="Member Details"
footer={footer}
width="wide"
footerPrefix={footerStart}
footerSuffix={footerActions}
>
<AuthZGuardContent
checks={member ? [buildUserReadPermission(member?.id)] : []}
@@ -779,7 +778,7 @@ function EditMemberDrawer({
>
{drawerContent}
</AuthZGuardContent>
</DrawerWrapper>
</Drawer>
<ResetLinkDialog
open={showResetLinkDialog}

View File

@@ -1,6 +1,6 @@
import { Check, Copy } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { DialogWrapper } from '@signozhq/ui/dialog';
import { Dialog } from '@signozhq/ui/dialog';
interface ResetLinkDialogProps {
open: boolean;
@@ -22,17 +22,11 @@ function ResetLinkDialog({
onCopy,
}: ResetLinkDialogProps): JSX.Element {
return (
<DialogWrapper
<Dialog
open={open}
onOpenChange={(isOpen): void => {
if (!isOpen) {
onClose();
}
}}
onClose={onClose}
title={linkType === 'invite' ? 'Invite Link' : 'Password Reset Link'}
showCloseButton
width="base"
className="reset-link-dialog"
>
<div className="reset-link-dialog__content">
<p className="reset-link-dialog__description">
@@ -65,7 +59,7 @@ function ResetLinkDialog({
</p>
)}
</div>
</DialogWrapper>
</Dialog>
);
}

View File

@@ -1,5 +1,5 @@
import type { ReactNode } from 'react';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { convertToApiError } from 'api/ErrorResponseHandlerForGeneratedAPIs';
import {
useCreateResetPasswordToken,
@@ -51,52 +51,31 @@ jest.mock('api/ErrorResponseHandlerForGeneratedAPIs', () => ({
jest.mock('@signozhq/ui/drawer', () => ({
...jest.requireActual('@signozhq/ui/drawer'),
DrawerWrapper: ({
Drawer: ({
children,
footer,
footerPrefix,
footerSuffix,
open,
}: {
children?: ReactNode;
footer?: ReactNode;
footerPrefix?: ReactNode;
footerSuffix?: ReactNode;
open: boolean;
}): JSX.Element | null =>
open ? (
<div>
{children}
{footer}
{footerPrefix}
{footerSuffix}
</div>
) : null,
}));
jest.mock('@signozhq/ui/dialog', () => ({
...jest.requireActual('@signozhq/ui/dialog'),
DialogWrapper: ({
children,
footer,
open,
title,
}: {
children?: ReactNode;
footer?: ReactNode;
open: boolean;
title?: string;
}): JSX.Element | null =>
open ? (
<div role="dialog" aria-label={title}>
{children}
{footer}
</div>
) : null,
DialogFooter: ({ children }: { children?: ReactNode }): JSX.Element => (
<div>{children}</div>
),
}));
jest.mock('@signozhq/ui/sonner', () => ({
...jest.requireActual('@signozhq/ui/sonner'),
jest.mock('@signozhq/ui/toast', () => ({
...jest.requireActual('@signozhq/ui/toast'),
toast: {
success: jest.fn(),
error: jest.fn(),
danger: jest.fn(),
},
}));
@@ -229,7 +208,7 @@ describe('EditMemberDrawer', () => {
isLoading: false,
});
(useDeleteUser as jest.Mock).mockReturnValue({
mutate: mockDeleteMutate,
mutateAsync: mockDeleteMutate,
isLoading: false,
});
// Token query: valid token for invited members
@@ -363,8 +342,11 @@ describe('EditMemberDrawer', () => {
renderDrawer({ onComplete });
// signoz-admin is already selected; add signoz-editor on top
await user.click(await screen.findByLabelText('Roles'));
await user.click(await screen.findByTitle('signoz-editor'));
await user.click(await screen.findByTestId('member-roles-select'));
await user.type(
await screen.findByTestId('member-roles-select-search'),
`${managedRoles[1].name}{Enter}`,
);
const saveBtn = screen.getByRole('button', { name: /save member details/i });
await waitFor(() =>
@@ -388,11 +370,11 @@ describe('EditMemberDrawer', () => {
renderDrawer({ onComplete });
// signoz-admin appears as a selected tag — click its remove button to deselect
const adminTag = await screen.findByTitle('signoz-admin');
const removeBtn = adminTag.querySelector(
'.ant-select-selection-item-remove',
) as Element;
await user.click(removeBtn);
await user.click(
await screen.findByTestId(
`member-roles-select-chip-${managedRoles[0].id}-remove`,
),
);
const saveBtn = screen.getByRole('button', { name: /save member details/i });
await waitFor(() =>
@@ -413,7 +395,7 @@ describe('EditMemberDrawer', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
mutate: mockDeleteMutate.mockImplementation(() => {
mutateAsync: mockDeleteMutate.mockImplementation(() => {
options?.mutation?.onSuccess?.();
}),
isLoading: false,
@@ -574,7 +556,7 @@ describe('EditMemberDrawer', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
mutate: mockDeleteMutate.mockImplementation(() => {
mutateAsync: mockDeleteMutate.mockImplementation(() => {
options?.mutation?.onSuccess?.();
}),
isLoading: false,
@@ -690,7 +672,7 @@ describe('EditMemberDrawer', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
mutate: mockDeleteMutate.mockImplementation(() => {
mutateAsync: mockDeleteMutate.mockImplementation(() => {
options?.mutation?.onError?.({});
}),
isLoading: false,
@@ -721,7 +703,7 @@ describe('EditMemberDrawer', () => {
const user = userEvent.setup({ pointerEventsCheck: 0 });
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
mutate: mockDeleteMutate.mockImplementation(() => {
mutateAsync: mockDeleteMutate.mockImplementation(() => {
options?.mutation?.onError?.({});
}),
isLoading: false,

View File

@@ -1,22 +1,16 @@
// The mask of the error modal blurs the page and any dialog under it, so a dialog's
// own backdrop would dim the page a second time.
body:has(.error-modal__wrap:not([style*='display: none'])) {
--dialog-backdrop-color: transparent;
--alert-dialog-backdrop-color: transparent;
}
.error-modal {
&__trigger {
width: fit-content;
display: flex;
align-items: center;
gap: 4px;
border-radius: 20px;
background: color-mix(in srgb, var(--danger-background) 20%, transparent);
padding-left: 3px;
padding-right: 8px;
cursor: pointer;
span {
color: var(--danger-background);
font-size: 10px;
font-weight: 500;
line-height: 20px; /* 200% */
letter-spacing: 0.4px;
text-transform: uppercase;
}
}
&__wrap {
background: linear-gradient(
@@ -65,7 +59,6 @@
&__value {
padding: 4px 8px;
font-size: 12px;
font-style: normal;
font-weight: 500;
line-height: 16px;
letter-spacing: 0.48px;

View File

@@ -18,6 +18,12 @@ type Props = {
open?: boolean;
};
// Above every `@signozhq/ui` dialog (`--dialog-z-index: 1001`, plus one per
// nested layer), so the error shows over the dialog whose action failed.
// TODO: temporary. Drop it once this moves to the `@signozhq/ui` Dialog, which
// stacks above the layer that opened it.
const ERROR_MODAL_Z_INDEX = 2000;
const classNames = {
body: 'error-modal__body',
mask: 'error-modal__mask',
@@ -53,8 +59,13 @@ function ErrorModal({
onClick={(): void => setVisible(true)}
onKeyDown={undefined}
>
<Badge variant="solid" color="danger">
<CircleAlert size={14} color={Color.BG_CHERRY_500} /> error
<Badge
variant="solid"
color="danger"
textTransform="uppercase"
prefix={<CircleAlert size={14} />}
>
error
</Badge>
</span>
) : (
@@ -90,6 +101,7 @@ function ErrorModal({
closeIcon={false}
classNames={classNames}
wrapClassName="error-modal__wrap"
zIndex={ERROR_MODAL_Z_INDEX}
>
<ErrorContent error={error} />
</Modal>

View File

@@ -38,7 +38,6 @@
margin: 0;
color: var(--l2-foreground);
font-size: 14px;
font-weight: 400;
line-height: 20px; /* 142.857% */
letter-spacing: -0.07px;
}
@@ -49,8 +48,6 @@
gap: 6px;
padding: 9px 12.5px;
color: var(--l2-foreground);
font-size: 12px;
font-weight: 400;
line-height: 18px; /* 150% */
letter-spacing: 0.12px;
border-radius: 2px;
@@ -79,7 +76,6 @@
color: var(--l2-foreground);
font-size: 12px;
font-weight: 500;
line-height: 18px; /* 150% */
letter-spacing: 0.48px;
pointer-events: none;
}
@@ -98,7 +94,6 @@
color: var(--l1-foreground);
font-size: 10px;
font-weight: 500;
line-height: 18px; /* 180% */
letter-spacing: 0.5px;
}
}
@@ -133,16 +128,12 @@
position: relative;
margin-bottom: 4px;
color: var(--l2-foreground);
font-family: Geist Mono;
font-size: 12px;
font-weight: 400;
line-height: 18px;
font-family: var(--code-base-400-font-family);
padding: 3px 12px;
padding-left: 26px;
}
&__message-item::before {
font-family: unset;
content: '';
position: absolute;
left: 12px;

View File

@@ -1,12 +1,12 @@
.export-menu-popover {
width: 240px;
padding: 0 12px 12px 12px;
// The popover shell carries no padding of its own, so the content owns it.
padding: var(--spacing-8);
.title {
display: flex;
color: var(--l1-foreground);
font-family: Inter;
font-size: var(--periscope-font-size-small);
font-size: var(--uppercase-small-500-font-size);
font-style: normal;
font-weight: 500;
line-height: 18px;
@@ -23,7 +23,7 @@
// radio option labels — radix popover content inherits the root font
// size; pin to the app's 13px base the antd popover used to impose
label {
font-size: var(--periscope-font-size-base);
font-size: var(--label-base-400-font-size);
}
}
}

View File

@@ -1,6 +1,6 @@
import { Download } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { Popover, PopoverContent, PopoverTrigger } from '@signozhq/ui/popover';
import { Popover, usePopoverHandle } from '@signozhq/ui/popover';
import { RadioGroup } from '@signozhq/ui/radio-group';
import { Tooltip } from '@signozhq/ui/tooltip';
import { Typography } from '@signozhq/ui/typography';
@@ -36,6 +36,10 @@ export default function ExportMenu({
}: ExportMenuProps): JSX.Element {
const [exportFormat, setExportFormat] = useState<string>(ExportFormat.Csv);
const [isPopoverOpen, setIsPopoverOpen] = useState<boolean>(false);
// Driven by a handle rather than `trigger`: the button carries a Tooltip, and a Tooltip
// routes every prop it does not recognise to its own popup, so a popover's press handlers
// would never reach the button underneath.
const menu = usePopoverHandle(setIsPopoverOpen);
const { isExporting, handleExport: handleClientExport } = useClientExport({
data,
@@ -45,53 +49,74 @@ export default function ExportMenu({
});
const handleExport = useCallback((): void => {
setIsPopoverOpen(false);
menu.close();
handleClientExport({ format: exportFormat as ExportFormat });
}, [exportFormat, handleClientExport]);
}, [menu, exportFormat, handleClientExport]);
return (
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
<>
<Tooltip title="Download">
<PopoverTrigger asChild>
<Button
variant="ghost"
color="secondary"
size="sm"
icon
aria-label="Download"
testId={`export-menu-${dataSource}`}
loading={isExporting}
>
<Download size={14} />
</Button>
</PopoverTrigger>
</Tooltip>
<PopoverContent align="end" className="export-menu-popover">
<div className="export-format">
<Typography.Text className="title">FORMAT</Typography.Text>
<RadioGroup
color="primary"
value={exportFormat}
onChange={setExportFormat}
items={[
{ value: ExportFormat.Csv, label: 'csv' },
{ value: ExportFormat.Jsonl, label: 'jsonl' },
]}
/>
</div>
<Button
size="md"
variant="solid"
color="primary"
width="100%"
onClick={handleExport}
variant="ghost"
color="secondary"
size="sm"
icon
aria-label="Download"
aria-haspopup="dialog"
aria-expanded={isPopoverOpen}
testId={`export-menu-${dataSource}`}
loading={isExporting}
prefix={<Download size={16} />}
onClick={(event): void =>
menu.isOpen ? menu.close() : menu.showAt(event.currentTarget)
}
>
Export
<Download size={14} />
</Button>
</PopoverContent>
</Popover>
</Tooltip>
<Popover
side="bottom"
align="end"
width={240}
handle={menu}
aria-label="Export format"
>
<div className="export-menu-popover">
<div className="export-format">
<Typography
variant="uppercase"
size="small"
weight="medium"
color="main"
as="p"
marginBottom={4}
textOverflow="wrap"
>
FORMAT
</Typography>
<RadioGroup
color="primary"
value={exportFormat}
onChange={setExportFormat}
items={[
{ value: ExportFormat.Csv, label: 'csv' },
{ value: ExportFormat.Jsonl, label: 'jsonl' },
]}
/>
</div>
<Button
size="md"
variant="solid"
color="primary"
width="100%"
onClick={handleExport}
loading={isExporting}
prefix={<Download size={16} />}
>
Export
</Button>
</div>
</Popover>
</>
);
}

View File

@@ -87,6 +87,17 @@ describe('ExportMenu', () => {
expect(screen.queryByText('FORMAT')).not.toBeInTheDocument();
});
it('closes the popover on a second press of the trigger', async () => {
renderMenu();
await userEvent.click(screen.getByTestId(TEST_ID));
expect(screen.getByText('FORMAT')).toBeInTheDocument();
await userEvent.click(screen.getByTestId(TEST_ID));
expect(screen.getByTestId(TEST_ID)).toHaveAttribute('aria-expanded', 'false');
expect(screen.queryByText('FORMAT')).not.toBeInTheDocument();
});
it('disables the trigger while an export is in progress', () => {
mockIsExporting = true;
renderMenu();

View File

@@ -117,9 +117,16 @@ function AddedFields({
<div className={styles.sectionHeader}>
<span>ADDED FIELDS</span>
{maxFields !== undefined && (
<Typography.Text size="sm" weight="medium" color="muted">
<Typography
variant="paragraph"
size="small"
weight="medium"
color="secondary"
as="span"
textOverflow="wrap"
>
Max Allowed: {maxFields}
</Typography.Text>
</Typography>
)}
</div>
<div className={styles.addedList}>

View File

@@ -32,12 +32,15 @@
}
}
// Full-bleed search bar: only top/bottom borders, square corners.
// Per-side widths cannot be expressed via --input-border-width.
.searchInput {
background-color: var(--l1-background);
height: 40px;
border-radius: 0;
border-left: none;
border-right: none;
--input-border-radius: 0;
[data-slot='input'] {
border-left: none;
border-right: none;
}
}
.section {

View File

@@ -1,5 +1,5 @@
import { useCallback, useMemo, useState } from 'react';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { Button } from '@signozhq/ui/button';
import { Input } from '@signozhq/ui/input';
import useDebouncedFn from 'hooks/useDebouncedFunction';
@@ -140,10 +140,10 @@ function FieldsSelectorContent({
<X className={styles.closeIcon} size={16} onClick={onClose} />
</div>
<section>
<section className={styles.searchInput}>
<Input
className={styles.searchInput}
type="text"
size="lg"
value={inputValue}
placeholder="Search for a field..."
onChange={handleInputChange}

View File

@@ -13,9 +13,9 @@ jest.mock('hooks/querySuggestions/useFieldKeysSuggestion', () => ({
})),
}));
jest.mock('@signozhq/ui/sonner', () => ({
...jest.requireActual('@signozhq/ui/sonner'),
toast: { success: jest.fn(), error: jest.fn() },
jest.mock('@signozhq/ui/toast', () => ({
...jest.requireActual('@signozhq/ui/toast'),
toast: { success: jest.fn(), danger: jest.fn() },
}));
// FloatingPanel is a react-rnd/portal shell — presentation only. Render its

View File

@@ -4,9 +4,16 @@ function AnnouncementsModal(): JSX.Element {
return (
<div className="announcements-modal-container">
<div className="announcements-modal-container-header">
<Typography.Text className="announcements-modal-title">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
Announcements
</Typography.Text>
</Typography>
</div>
</div>
);

View File

@@ -1,8 +1,9 @@
import { useCallback, useEffect, useState } from 'react';
import { useAppLocation } from 'lib/router/useAppLocation';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { Button, Input } from 'antd';
import { ToggleGroup } from '@signozhq/ui/toggle-group';
import { Button as SignozButton } from '@signozhq/ui/button';
import { Typography } from '@signozhq/ui/typography';
import logEvent from 'api/common/logEvent';
import { handleContactSupport } from 'container/Integrations/utils';
@@ -39,7 +40,8 @@ function FeedbackModal({ onClose }: { onClose: () => void }): JSX.Element {
})
.catch(() => {
console.error(`Failed to submit ${entityName}`);
toast.error(`Failed to submit ${entityName}`, {
toast.danger(`Failed to submit ${entityName}`, {
action: { label: 'Dismiss' },
position: 'top-right',
});
})
@@ -136,14 +138,23 @@ function FeedbackModal({ onClose }: { onClose: () => void }): JSX.Element {
Submit
</Button>
<div className="feedback-modal-content-footer-info-text">
<Typography.Text>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
Have a specific issue?{' '}
<Typography.Link
className="contact-support-link"
<SignozButton
variant="link"
color="primary"
size="sm"
onClick={handleContactSupportClick}
>
Contact Support{' '}
</Typography.Link>
</SignozButton>
or{' '}
<a
href="https://signoz.io/docs/introduction/"
@@ -153,7 +164,7 @@ function FeedbackModal({ onClose }: { onClose: () => void }): JSX.Element {
>
Read our docs
</a>
</Typography.Text>
</Typography>
</div>
</div>
</div>

View File

@@ -65,15 +65,6 @@
gap: 8px;
align-items: center;
justify-content: space-between;
.absolute-relative-time-toggler-label {
color: var(--l1-foreground);
font-size: 13px;
font-style: normal;
font-weight: 500;
line-height: 20px; /* 142.857% */
letter-spacing: -0.07px;
}
}
.absolute-relative-time-toggler {
@@ -98,24 +89,6 @@
display: flex;
flex-direction: column;
gap: 4px;
.url-share-title,
.url-share-sub-title {
color: var(--l1-foreground);
font-size: 13px;
font-style: normal;
font-weight: 500;
line-height: 20px; /* 142.857% */
letter-spacing: -0.07px;
}
.url-share-sub-title {
font-size: 12px;
color: var(--l3-foreground);
font-weight: 400;
line-height: 18px;
letter-spacing: -0.06px;
}
}
}
}
@@ -183,7 +156,6 @@
font-weight: 500;
line-height: 24px; /* 200% */
.contact-support-link,
.read-docs-link {
color: var(--bg-robin-400);
font-weight: 500;

View File

@@ -128,7 +128,16 @@ function HeaderRightSection({
}
prefix={<Noz size={20} />}
>
<Typography.Text>Noz</Typography.Text>
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
Noz
</Typography>
</Button>
</Tooltip>
</span>

View File

@@ -141,9 +141,16 @@ function ShareURLModal({ extraOption }: ShareURLModalProps): JSX.Element {
{(shareURLWithTime || isRouteToBeSharedWithTime) && (
<>
<div className="absolute-relative-time-toggler-container">
<Typography.Text className="absolute-relative-time-toggler-label">
<Typography
variant="paragraph"
size="base"
weight="medium"
color="main"
as="span"
textOverflow="wrap"
>
Enable absolute time
</Typography.Text>
</Typography>
<div className="absolute-relative-time-toggler">
{!isValidateRelativeTime && (
@@ -172,9 +179,16 @@ function ShareURLModal({ extraOption }: ShareURLModalProps): JSX.Element {
{extraOption && (
<div className="absolute-relative-time-toggler-container">
<Typography.Text className="absolute-relative-time-toggler-label">
<Typography
variant="paragraph"
size="base"
weight="medium"
color="main"
as="span"
textOverflow="wrap"
>
{extraOption.label}
</Typography.Text>
</Typography>
<div className="absolute-relative-time-toggler">
<Switch
color="primary"
@@ -189,12 +203,26 @@ function ShareURLModal({ extraOption }: ShareURLModalProps): JSX.Element {
<div className="share-link">
<div className="url-share-container">
<div className="url-share-container-header">
<Typography.Text className="url-share-title">
<Typography
variant="paragraph"
size="base"
weight="medium"
color="main"
as="span"
textOverflow="wrap"
>
Share page link
</Typography.Text>
<Typography.Text className="url-share-sub-title">
</Typography>
<Typography
variant="paragraph"
size="small"
weight="regular"
color="tertiary"
as="span"
textOverflow="wrap"
>
Share the current page link with your team member
</Typography.Text>
</Typography>
</div>
<Button

View File

@@ -1,6 +1,6 @@
// Mock dependencies before imports
import { useAppLocation } from 'lib/router/useAppLocation';
import { toast } from '@signozhq/ui/sonner';
import { toast } from '@signozhq/ui/toast';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { logEventMock } from '__tests__/logEventMock';
@@ -13,11 +13,11 @@ jest.mock('lib/router/useAppLocation', () => ({
useAppLocation: jest.fn(),
}));
jest.mock('@signozhq/ui/sonner', () => ({
...jest.requireActual('@signozhq/ui/sonner'),
jest.mock('@signozhq/ui/toast', () => ({
...jest.requireActual('@signozhq/ui/toast'),
toast: {
success: jest.fn(),
error: jest.fn(),
danger: jest.fn(),
},
}));
@@ -49,7 +49,7 @@ describe('FeedbackModal', () => {
isCloudUser: false,
});
mockToast.success.mockClear();
mockToast.error.mockClear();
mockToast.danger.mockClear();
});
it('should render feedback modal with all tabs', () => {

View File

@@ -27,7 +27,7 @@
}
.infra-container-card-text {
font-size: var(--font-size-sm);
font-size: var(--paragraph-base-400-font-size);
color: var(--l2-foreground);
line-height: 20px;
letter-spacing: -0.07px;

View File

@@ -27,7 +27,7 @@
}
.infra-container-card-text {
font-size: var(--font-size-sm);
font-size: var(--paragraph-base-400-font-size);
color: var(--l2-foreground);
line-height: 20px;
letter-spacing: -0.07px;

View File

@@ -52,9 +52,16 @@ export default function WaitlistFragment({
return (
<div className="wait-list-container">
<Typography.Text className="wait-list-text">
<Typography
variant="paragraph"
size="base"
weight="regular"
color="inherit"
as="span"
textOverflow="wrap"
>
{t('waitlist_message')}
</Typography.Text>
</Typography>
<Button
className="periscope-btn join-waitlist-btn"

View File

@@ -4,14 +4,13 @@
border-radius: 2px 0px 0px 2px;
// The label chip and the Input share the --input-with-label-* theming
// contract (set by e.g. FormAlertRules, WidgetFullView) so the joined
// group recolors as one.
.label {
// Typography.Text takes its display from this token; at its `inline` default
// the label blockifies as a flex item and the text rides the top of the row.
--typography-text-display: flex;
font-size: 12px;
font-style: normal;
font-weight: 500;
font-weight: 300;
line-height: 18px; /* 128.571% */
letter-spacing: 0.56px;
@@ -25,72 +24,47 @@
border-radius: 2px 0px 0px 2px;
border: 1px solid var(--input-with-label-border-color, var(--l2-border));
background: var(--input-with-label-background-color, var(--l2-background));
background: var(--input-with-label-background-color, var(--input-background));
color: var(--input-with-label-color, var(--l2-foreground));
display: flex;
justify-content: flex-start;
align-items: center;
font-weight: var(--font-weight-light);
}
.input {
flex: 1;
min-width: 150px;
font-family: 'Space Mono', monospace !important;
--input-border-radius: 0px;
border: 1px solid var(--input-with-label-border-color, var(--l2-border));
background: var(--input-with-label-background-color, var(--l2-background));
color: var(--input-with-label-color, var(--l2-foreground));
font-size: 12px !important;
line-height: 25px;
position: relative;
// Square corners: the input sits mid-group between label and close button.
--input-border-radius: 0px;
--input-sm-height: 36px;
--input-padding: 0 12px;
--input-font-family: 'Space Mono', monospace;
--input-font-size: 12px;
--input-letter-spacing: normal;
--input-border: var(--input-with-label-border-color, var(--l2-border));
--input-background-color: var(
--input-with-label-background-color,
var(--input-background)
);
--input-foreground: var(--input-with-label-color, var(--l2-foreground));
&:hover,
&:focus {
&:focus-within {
z-index: 1;
}
.ant-select-selector {
position: relative;
border-radius: inherit;
}
.ant-select:hover .ant-select-selector,
.ant-select-focused .ant-select-selector {
z-index: 1;
}
&.input__has-label-after {
margin-left: -1px;
.ant-select-selector {
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
&.input__has-close-button {
.ant-select-selector {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
~ .close-btn {
margin-left: -1px;
border-left-width: 0;
}
}
&::placeholder {
color: var(--input-with-label-color, var(--l3-foreground)) !important;
font-size: 12px !important;
}
&[type='number']::-webkit-inner-spin-button,
&[type='number']::-webkit-outer-spin-button {
// The Input has no token for the native number spinners.
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
@@ -101,7 +75,7 @@
.close-btn {
border-radius: 0px 2px 2px 0px;
border: 1px solid var(--input-with-label-border-color, var(--l2-border));
background: var(--input-with-label-background-color, var(--l2-background));
background: var(--input-with-label-background-color, var(--input-background));
height: 100%;
width: 38px;
position: relative;
@@ -112,18 +86,14 @@
}
}
// The input draws the divider; overlapping borders would double up.
&:not(.labelAfter) .label {
border-right-width: 0;
}
&.labelAfter {
.input {
border-radius: 2px;
border: 1px solid var(--input-with-label-border-color, var(--l2-border));
background: var(--input-with-label-background-color, var(--l2-background));
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
.ant-select-selector {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
--input-border-radius: 2px 0 0 2px;
}
.label {

Some files were not shown because too many files have changed in this diff Show More