Compare commits
46 Commits
chore/dead
...
issue_nerv
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35bb154358 | ||
|
|
0bac4990ef | ||
|
|
f028897749 | ||
|
|
f4023c9f6f | ||
|
|
791d150554 | ||
|
|
56a3148a77 | ||
|
|
af7d1d31fd | ||
|
|
eed2c7d177 | ||
|
|
ff3bff481a | ||
|
|
5902ba86c4 | ||
|
|
5870d1f2b5 | ||
|
|
d63c6fb344 | ||
|
|
9341922a83 | ||
|
|
015e0ab502 | ||
|
|
af8e036412 | ||
|
|
94ead23432 | ||
|
|
9ed59f872b | ||
|
|
63caf73fdb | ||
|
|
9ef7def96c | ||
|
|
d2ca350b51 | ||
|
|
478a7645e4 | ||
|
|
1d0b83cb6d | ||
|
|
6f5d3af7f7 | ||
|
|
b0386a0850 | ||
|
|
ca4f2f5236 | ||
|
|
9777092344 | ||
|
|
de7a4c084c | ||
|
|
eaf4cb9a81 | ||
|
|
0acf668098 | ||
|
|
f0868980ac | ||
|
|
4d3edfc60f | ||
|
|
d79b50e6fc | ||
|
|
122a28eecc | ||
|
|
319149f3f9 | ||
|
|
3ad9300dd3 | ||
|
|
de2f960771 | ||
|
|
9e5e145b46 | ||
|
|
e892107960 | ||
|
|
273ec41fb3 | ||
|
|
b81bbea9f1 | ||
|
|
8954823bf9 | ||
|
|
08cca0f59b | ||
|
|
690a2af781 | ||
|
|
82c8c1c43d | ||
|
|
75686f4004 | ||
|
|
2df97d39e2 |
@@ -20,16 +20,12 @@ You are the Playwright Test Generator for the SigNoz frontend. You take a plan w
|
||||
await expect(routing.activeRouteTab(PATH.metricsSummary)).toBeVisible();
|
||||
});
|
||||
```
|
||||
- A driver is a function closing over the page that returns `Locator` getters and async actions. Actions wait inside themselves (e.g. `run()` pairs the click with `waitForResponse(/query_range/)`), so specs don't. A wait for "the request the action fired" skips aborted requests, which have no response: Run after a cancel re-sends the cancelled query and aborts it, and `query-builder/run` TC-34 read that one.
|
||||
- A page action that opens an explorer waits for the content pane's scrollbar viewport (`quick-filters-layout-content [data-overlayscrollbars-viewport]`) before anything types. The scrollbar starts on idle and re-parents the editors, so keys typed across it land at the start of the text. Typing into a CodeMirror editor retypes until the editor holds exactly the text, as `editorAt(...).type` and `querySearch.apply` do: `query-builder/aggregation` TC-17 sent `c()` for `count()`.
|
||||
- A driver is a function closing over the page that returns `Locator` getters and async actions. Actions wait inside themselves (e.g. `run()` pairs the click with `waitForResponse(/query_range/)`), so specs don't.
|
||||
- `driver(name, build, dispose?)` in `drivers/kit.ts` makes it a test-scoped fixture on `authedPage`; `dispose` deletes what it seeded. `seeded(name, open, close)` makes a worker-scoped seed.
|
||||
- Read [tests/e2e/tests/dashboards/editor/query.spec.ts](../../tests/e2e/tests/dashboards/editor/query.spec.ts) and [drivers/panel-editor.ts](../../tests/e2e/drivers/panel-editor.ts) for the canonical shape.
|
||||
- **Seeds are layers on the feature's `test`.** A spec destructures the seed it needs (`alertList`, `ownedRules`, `resolvedHistory` for alerts) instead of importing a fixtures module. A new seed goes in the feature's driver directory: `seeded()` for read-only data shared by a worker, a test-scoped layer for anything a test mutates.
|
||||
- **Test titles:** `TC-NN <short description>` — matches the planner's IDs.
|
||||
- **Self-contained state.** The bootstrap creates a fresh stack with **zero** dashboards / alerts / etc. Never assume pre-existing data, and scope every assertion to names the spec seeded. Pick the scope per the Seeding table in [tests/e2e/AGENTS.md](../../tests/e2e/AGENTS.md): test scope (a test-scoped layer, or `try / finally` through the driver) for mutations, worker scope (`seeded()`) for read-only data, suite `beforeAll` for a dataset only one file uses.
|
||||
- **A seed adds to org-wide settings, never replaces them.** Quick filters, org preferences and similar settings are shared by every spec on the stack, and `fullyParallel` runs those specs at once. Read the stored value and write a superset with only the missing entries, as `quickFilters.seed` does. A seed that replaced the logs filters made `query-builder/filter` TC-16 fail later on the same stack, and a restore in teardown races a parallel spec that seeded the same setting.
|
||||
- **Close a multiple combobox from its trigger, never with Escape.** A multi-select stays open after a pick, and Escape also closes the dialog or page around it; `onboarding/get-started` TC-09 landed on `/home`. `comboboxAt(...).pick` already does this.
|
||||
- **A context you open yourself drops its routes before closing.** Call `page.unrouteAll({ behavior: 'ignoreErrors' })` before `ctx.close()`, as `authedPage` does; a handler still inside `route.fetch` otherwise fails a test that already passed.
|
||||
- **Drive everything through the feature's driver** in `tests/e2e/drivers/`. A spec that reaches for `page.locator(...)` or `page.getByTestId(...)` is missing a driver method — add the method instead. `onAdminPage(browser, …)` from `drivers/kit.ts` is what suite hooks use, because `authedPage` is test-scoped and not visible to them.
|
||||
- **Seed through the kit when the UI flow is not under test.** Control-plane objects go through the feature driver (`dashboards.seed`, `alerts.seed.threshold`), which uses `apiDriver(page)` from `drivers/api.ts`; telemetry goes to the seeder. `page.request.*` does **not** carry the token, so never seed with it.
|
||||
- **Golden telemetry is pre-seeded.** `bootstrap/global.setup.ts` loads logs, traces and metrics over the last 6h (constants in `GOLDEN`, `drivers/dashboard-spec.ts`). Query within ≤ 6h and assert structure (series, rows, request payload), never exact counts.
|
||||
|
||||
@@ -50,9 +50,6 @@ Don't try to start the stack yourself — it can take ~4 minutes on a cold build
|
||||
- **Auth.** `tests/e2e/drivers/auth.ts` logs in once per worker and caches `storageState` (localStorage with `AUTH_TOKEN`). For API-driven seeding and cleanup use `apiDriver(page)` from `drivers/api.ts`, which attaches the header for you. Never re-implement login.
|
||||
- **Seeds.** Feature seeds are layers on the feature's `test`, e.g. `alertList`, `ownedRules` and `resolvedHistory` in `drivers/alerts/seeds.ts`. When a test fails on missing data, check which seed it destructures and whether it scopes to that seed's names.
|
||||
- **Timeouts.** Never add `test.slow()` to a driver: it triples the remaining budget per call and compounds in loops. Use `allowFor(floor)` from `drivers/kit.ts`. Budgets and their measurements are in `tests/e2e/docs/flake-notes.md`.
|
||||
- **A failure that shows only late in a long local run.** Run that spec's shard alone on a freshly seeded stack before fixing it, as CI does. A setting another spec changed and never restored, or golden telemetry aging past a query window, fails it only after the rest of the suite.
|
||||
- **`route.fetch: Target page, context or browser has been closed` after the test passed.** A route handler was still fetching when the context closed. Unroute with `page.unrouteAll({ behavior: 'ignoreErrors' })` before `ctx.close()` in the fixture that opened the context.
|
||||
- **Escape after a multi-select pick lands on another page.** Escape closed the dialog around the combobox too. Close it from its trigger (`comboboxAt(...).pick` does), never with another Escape.
|
||||
- **CI-only failures.** Reproduce with `STRESS=1 CI=1 pnpm test <path>` from `tests/e2e/` before calling it a product bug.
|
||||
- **Commits.** Driver fixes and spec fixes go in separate commits (see Commits in `tests/e2e/AGENTS.md`).
|
||||
- **Ant Design popovers** (sort menu, action menu) are click-toggle. The trigger element is often an inline `<svg>` with a `data-testid` — clicking it opens the popover; clicking it again closes. After selecting an option, the popover auto-closes. If a test interacts with the popover twice, wait for the menu items to be visible explicitly between toggles.
|
||||
|
||||
8
.claude/rules/ai-terms.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# AI observability terms
|
||||
|
||||
One name for each thing, in field names, descriptions, column aliases, UI text and tests. The names are those of the AI explorer's per-trace fields, `TraceAggregateFields` in `pkg/telemetryschema/aitelemetryschema/const.go`.
|
||||
|
||||
- **LLM call**: a span with `gen_ai.request.model`. Its count is `llm_call_count`, or `llmCallCount` in a camelCase response.
|
||||
- **Tool call**: a span with `gen_ai.tool.name`. Its count is `tool_call_count`, or `toolCallCount`.
|
||||
- **gen_ai span**: a span with any of `GenAISpanGateKeys`: an LLM call, a tool call or an agent span.
|
||||
- **Review check.** "model call", `modelCall` or `model_call` in a name, a description or UI text is a finding: it is an LLM call.
|
||||
@@ -9,15 +9,12 @@ paths:
|
||||
Examples and the harness API live in [`frontend/src/tests/README.md`](../../frontend/src/tests/README.md).
|
||||
|
||||
- **Import from the harness.** `render`, `screen`, `userEvent`, `waitFor` and the rest come from `tests/test-utils`, never from `@testing-library/react`. The harness mounts the router, React Query, Redux, app context and preferences. When it can't do what a test needs, extend `tests/test-utils` instead of importing around it.
|
||||
- **Find elements by test ID.** Query with `getByTestId`/`findByTestId` on the `data-testid` or `testId` the component exposes, and add one to the component when it has none. Fall back to role or text only for markup the app doesn't own. A test ID matches exactly one element and survives copy and markup changes; `getByRole` checks the computed style of every element it visits and is the slowest query. Always go through Testing Library (`screen`, `within`), never the DOM: no `querySelector`, `closest`, `container` or `document.body`. `signoz/no-dom-node-access` flags the DOM calls in test files; a test that checks DOM structure on purpose disables it on that line with a reason. Never call a `*ByRole` query inside `waitFor` or a loop: `waitFor` re-runs its callback every 50 ms. Wait with `findByTestId`, then query.
|
||||
- **Interact like a user.** `const user = userEvent.setup()`, then an awaited `user.click`, `hover`, `keyboard` or `type`. The harness turns off the pointer-events check: Base UI popups sit inside an element with an inline `pointer-events: none`, and the stylesheet that turns it back on for the popup never loads in jsdom, so the check would block every click on them. Never turn it back on. `fireEvent` only for events `userEvent` has no equivalent for: scroll, resize, setting `scrollTop`.
|
||||
- **Drop user-event's pause: `userEvent.setup(NO_DELAY_USER_EVENT)`** from `tests/test-utils`; spread it when the test needs other options. The default `delay: 0` waits a `setTimeout` after every key and click, so typing 40 characters waits 40 timer turns, each slower on a busy CI runner. With `delay: null` the actions run back to back. For a long value, click the field and `user.paste(text)` instead of typing it. Keep the default when the test checks what happens between two actions, such as a debounce per key or an update on a timer or `requestAnimationFrame` between steps: with `null` that code runs only after the whole action. Under `null` the Jest timeout can't fire mid-action, so judge a slow test by its `--verbose` time, not by whether it fails.
|
||||
- **Find elements by test ID.** Query with `getByTestId`/`findByTestId` on the `data-testid` or `testId` the component exposes, and add one to the component when it has none. Fall back to role or text only for markup the app doesn't own. A test ID matches exactly one element and survives copy and markup changes; `getByRole` computes the accessibility tree on every call and is the slowest query.
|
||||
- **Interact like a user.** `const user = userEvent.setup({ pointerEventsCheck: 0 })`, then an awaited `user.click`, `hover`, `keyboard` or `type`. `fireEvent` only for events `userEvent` has no equivalent for: scroll, resize, setting `scrollTop`.
|
||||
- **Fake timers per test only**, for debounce or throttle, with `userEvent.setup({ advanceTimers: (ms) => jest.advanceTimersByTime(ms) })`. Never global.
|
||||
- **Network through MSW.** The global server runs for every test; override per test with `server.use(...)` from `mocks-server/server`. Large fixtures go in `mocks-server/__mockdata__`.
|
||||
- **Router through the harness.** Pass `initialRoute`/`routePath` to `render` and assert with `getCurrentLocation()` from `lib/router/navigation`. Never mock `react-router`, `react-router-dom` or `lib/history`; when a test can't render at a route, use the `lib/router` spies in `tests/router-mocks`.
|
||||
- **Mock only business boundaries.** Local `jest.mock` for API modules, custom hooks and domain components. Never re-mock what the harness provides (`@testing-library/user-event` in `jest.setup.ts`) or what `jest.config.ts` maps (`uplot`, `@signozhq/icons`, `useSafeNavigate`, `logEvent`).
|
||||
- **Mock only business boundaries.** Local `jest.mock` for API modules, custom hooks and domain components. Never re-mock what the harness provides or what `jest.config.ts` maps (`uplot`, `@signozhq/icons`, `useSafeNavigate`, `logEvent`).
|
||||
- **Type mocks and fixtures.** `jest.mocked(fn)` for module mocks, `jest.fn() as jest.MockedFunction<T>` for a standalone mock you configure or assert on. Fixtures carry their real type, from `src/api/generated` where it exists. No `any`, no `as unknown as`. An inline `onX={jest.fn()}` on a typed prop that is never asserted needs no annotation.
|
||||
- **One behaviour per test, at the smallest render.** Render the component that owns the behaviour, not the page around it, unless the page wiring is the behaviour. A flow of steps (a wizard, a multi-step form) becomes one test per step that starts at that step through props, store or route. A full click-through belongs in the e2e suite (`tests/e2e`).
|
||||
- **Each test under 500 ms.** `pnpm jest <file> --verbose` prints each test's time. CI runs about four times slower than a laptop, and the timeout is 5 s. Never raise a timeout (`jest.setTimeout`, a third argument to `it`) to make a slow test pass; slim the test instead.
|
||||
- **A test fails without its change.** At the gate in [`frontend/AGENTS.md`](../../frontend/AGENTS.md), revert the change, or break the line under test, and run the test: it must fail, and each test must stay under 500 ms. Assert the specific outcome (exact text, request payload, call arguments), never only that an element exists.
|
||||
- **A test fails without its change.** Revert the change, or break the line under test, and run the test before you finish: it must fail. Assert the specific outcome (exact text, request payload, call arguments), never only that an element exists.
|
||||
- **No limit on tests per file.** Split a file when it mixes unrelated behaviour, not to hit a count.
|
||||
|
||||
@@ -15,4 +15,3 @@ paths:
|
||||
- When defining types, keep the structure of file to have any constants and variables first, then exported types and exported methods and then finally the unexported types and methods.
|
||||
- Never import types or other modules in migration files, duplicate the required type or method to keep migration free from changes.
|
||||
- Always run the gofmt tool for formating beforing commiting any changes.
|
||||
- **Never copy through a pointer dereference** (`copied := *original`). It copies only the top level: pointer, slice and map fields stay shared, so changing the copy can change the original. Use the type's `Copy()` when it has one (`QueryBuilderFormula.Copy`); otherwise create a new struct literal from the fields you need. A `Copy()` itself may dereference, as long as it then replaces every pointer, slice and map field.
|
||||
|
||||
@@ -10,6 +10,5 @@
|
||||
- **Use convensional commit format** for commits and PR title.
|
||||
- **Do not amend the commits once pushed.** Always create a new commit once changes are pushed to remote.
|
||||
- **Review fixes are new commits too.** A force push hides what changed from human reviewers and makes Greptile post its findings again. Bring in `main` with a merge; only a stacked branch (`gh stack`) rebases, since the stack moves as a unit.
|
||||
- **A review fix to an AI-owned file fixes its generator too.** A file with the AI-owned banner (story mocks and plays, `tests/e2e/drivers/`) is rewritten by the skill or agent that made it, so a fix made only in the file comes back on the next run. In the same PR, add the lesson to that skill or agent as a concrete case.
|
||||
- **Answer every Greptile thread.** Reply with the commit that fixes it (`Fixed in 4df6f3198d: <what changed>`) or the reason it stays, then resolve. Never resolve one with neither: Greptile withdraws a finding, and remembers it, only when told why.
|
||||
- **Leave human review threads to the author.** Fix the code they ask for, but never reply to or resolve a human reviewer's thread.
|
||||
|
||||
@@ -110,9 +110,8 @@ await expect(toggle.getAttribute('aria-checked')).toBe(before);
|
||||
|
||||
CI runs each play once, with its story's own args. Anyone can flip a control in the panel, and nothing runs the play against that value, so a play that breaks on it goes unnoticed. Write each play so it cannot.
|
||||
|
||||
Before writing the clicks, list what has to be on screen for the play's target to exist. Then walk every control the story exposes, the page's own as well as the shared ones, and return early for each value that takes something on that list away. These are the cases plays have missed:
|
||||
Before writing the clicks, list what has to be on screen for the play's target to exist, and return early when the args take it away. These are the cases plays have missed:
|
||||
|
||||
- An arg the story sets. The story sets it because the play needs what that value renders, and the panel can flip it. On the `mine` view the dashboards Created-by filter opens with a tag to remove; on the other views it opens empty and there is no × to click. Check the tag is there by parsing the route the view resolves to.
|
||||
- The controls every story has. `State` on loading or error renders no rows and no filter suggestions. `Access`, `Permissions` and `Revoked` remove rows, row actions and gated buttons, and the `editor` and `viewer` presets grant telemetry reads only, so a page gated on its own resource shows them nothing. `Check state` on loading disables every gated control, and on error an `AuthZButton` stays enabled while an `AuthZGuardContent` set to fail closed hides what it wraps. `License` and `Banner` decide the plan, so a cloud-only form is gone on the others. `Hold tooltips open` shows a label a second time, inside its tooltip.
|
||||
- A count at 0. The page can swap its whole list for an empty state, and the header, filters and column picker go with it.
|
||||
- A view, filter or invalid query that leaves no rows, even when the count is above 0.
|
||||
@@ -123,11 +122,10 @@ Before writing the clicks, list what has to be on screen for the play's target t
|
||||
|
||||
Make those checks with the page's own code instead of restating a condition. Build the rows with the builder the handler uses and the view's own filter, and check a permission with the page's own check through `accessFor(...).allows(...)`, or the role against the constant the page gates on, such as `componentPermission.action`. Export the checks from the mocks module, next to the handlers, so a handler change moves them too. The alert rules page has `listedRules`, `hasRowMenu`, `showsNoRulesPage` and `listsSavedViews`; the dashboards list has `listedDashboards`, `canList`, `canCreate` and `canUpdate`.
|
||||
|
||||
Three habits cover the rest:
|
||||
Two habits cover the rest:
|
||||
|
||||
- Use `findAllBy*` and take the first whenever the text can appear twice, such as in a tooltip or a popover title.
|
||||
- Wrap `toBeVisible` in `waitFor` for anything that fades in. A tooltip or toast found the moment it mounts is not visible yet.
|
||||
- Wait for what a click depends on before clicking. A control can do something else until a request answers: in the cloud account setup, Cancel closes the drawer outright until the agent command exists, and asks to confirm only after. Clicking Cancel straight after Generate raced the account POST on CI; find `<provider>-agent-command` first.
|
||||
|
||||
## Rules
|
||||
|
||||
|
||||
12
.github/workflows/goci.yaml
vendored
@@ -63,7 +63,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: check-semconv-generated-files
|
||||
@@ -78,7 +78,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: qemu-install
|
||||
@@ -114,7 +114,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: generate-openapi
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: generate-authz
|
||||
@@ -148,7 +148,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: generate-web-settings
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
- name: self-checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: go-install
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.25"
|
||||
- name: generate-transaction-groups
|
||||
|
||||
@@ -131,10 +131,6 @@ func runGenerateAuthz(_ context.Context) error {
|
||||
coretypes.NewResourceRef(coretypes.ResourceMetaResourceNotificationChannel).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceUser).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceMetaResourceFactorPassword).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceMetaResourceIngestionKey).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceMetaResourceIngestionLimit).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceMetaResourceAuthDomain).String(): true,
|
||||
coretypes.NewResourceRef(coretypes.ResourceOrganization).String(): true,
|
||||
}
|
||||
|
||||
allowedTypes := map[string]bool{}
|
||||
|
||||
1194
docs/api/openapi.yml
@@ -99,7 +99,7 @@ is still by hand. The generator never adds a SideNav item; do that in
|
||||
CSS Modules (`docs/css-modules-guide.md`), React Query for server state (prefer
|
||||
`api/generated` hooks), nuqs for URL state, Zustand for client state, `data-testid` on
|
||||
every interactive element.
|
||||
5. **Verify** at the gate in `AGENTS.md` (commit, push or PR), not after each edit; skip it while the user says `no checks`:
|
||||
5. **Verify** before reporting done:
|
||||
```bash
|
||||
pnpm tsgo --noEmit
|
||||
pnpm oxlint src/pages/<Feature>
|
||||
|
||||
@@ -296,8 +296,6 @@
|
||||
// Bans msw imports in *.stories.tsx; handlers/mock data belong in the sibling .stories.mocks.tsx
|
||||
"signoz/no-direct-react-router-import": "error",
|
||||
// Steers call sites to the src/lib/router facade (allowlisted in overrides below)
|
||||
"signoz/no-builder-ai-query-access": "error",
|
||||
// Steers AI slot access to lib/query/builderSlot (allowlisted in overrides below)
|
||||
"no-restricted-globals": [
|
||||
"error",
|
||||
{
|
||||
@@ -318,11 +316,6 @@
|
||||
"name": "redux",
|
||||
"message": "[State mgmt] redux is deprecated. Migrate to Zustand, nuqs, or react-query."
|
||||
},
|
||||
{
|
||||
"name": "@signozhq/design-tokens",
|
||||
"importNames": ["Style"],
|
||||
"message": "[bundle] Style is a large object of CSS variable strings and is not tree-shaken. Write the CSS variable directly, for example 'var(--l3-foreground)'."
|
||||
},
|
||||
{
|
||||
"name": "react-redux",
|
||||
"message": "[State mgmt] react-redux is deprecated. Migrate to Zustand, nuqs, or react-query."
|
||||
@@ -345,11 +338,6 @@
|
||||
"importNames": ["patchDashboardV2", "usePatchDashboardV2"],
|
||||
"message": "[dashboard-v2] Don't call patchDashboardV2/usePatchDashboardV2 directly — use useOptimisticPatch().patchAsync so spec edits update the react-query cache optimistically and reconcile on settle."
|
||||
},
|
||||
{
|
||||
"name": "antd/lib",
|
||||
"allowTypeImports": true,
|
||||
"message": "[bundle] antd/lib is the CommonJS root and bundles every antd component. Import from 'antd' instead."
|
||||
},
|
||||
{
|
||||
"name": "motion/react-client",
|
||||
"message": "[motion] motion/react-client is for React Server Components only. Use 'motion/react' instead — it provides the same exports and works correctly in client-side SPAs."
|
||||
@@ -518,6 +506,7 @@
|
||||
"ignorePatterns": [
|
||||
"src/parser/*.ts",
|
||||
"scripts/update-registry.cjs",
|
||||
"scripts/generate-permissions-type.cjs",
|
||||
"**/node_modules",
|
||||
"**/build",
|
||||
"**/*.typegen.ts",
|
||||
@@ -563,7 +552,6 @@
|
||||
],
|
||||
"rules": {
|
||||
"import/first": "off",
|
||||
"signoz/no-dom-node-access": "error",
|
||||
// Should ignore due to mocks
|
||||
"signoz/no-navigator-clipboard": "off",
|
||||
// Tests can use navigator.clipboard directly,
|
||||
@@ -571,8 +559,6 @@
|
||||
"no-restricted-globals": "off",
|
||||
// Tests need raw localStorage/sessionStorage to seed DOM state for isolation
|
||||
"signoz/no-zustand-getstate-in-hooks": "off",
|
||||
"signoz/no-builder-ai-query-access": "off",
|
||||
// Fixtures build and assert on the raw AI slot
|
||||
"@typescript-eslint/no-explicit-any": "off", // Tests often need any for mocks/stubs
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off", // Return types not required in tests
|
||||
"@typescript-eslint/explicit-function-return-type": "off" // Same as above rule, don't need to care about return type
|
||||
@@ -629,20 +615,6 @@
|
||||
"rules": {
|
||||
"signoz/no-direct-react-router-import": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
// builderSlot owns the AI slot; the rest normalise its wire shape or test whether it exists, which the helpers hide
|
||||
"files": [
|
||||
"src/lib/query/builderSlot.ts",
|
||||
"src/hooks/queryBuilder/normalizeCompositeQuery.ts",
|
||||
"src/hooks/queryBuilder/useGetCompositeQueryParam.ts",
|
||||
"src/providers/QueryBuilder.tsx",
|
||||
"src/pages/DashboardPage/DashboardContainer/PanelEditor/hooks/usePanelKindChange.ts",
|
||||
"src/pages/DashboardPage/DashboardContainer/Panels/utils/seedBuilderForMode.ts"
|
||||
],
|
||||
"rules": {
|
||||
"signoz/no-builder-ai-query-access": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import i18n from '../src/ReactI18';
|
||||
// `src/index.tsx` does this at boot: without it `@monaco-editor/react` falls back
|
||||
// to its loader default and pulls Monaco from cdn.jsdelivr.net, which msw does
|
||||
// not report because the requests look like static assets.
|
||||
import '../src/lib/monaco/loader';
|
||||
import '../src/lib/monaco/setup';
|
||||
|
||||
import '../src/styles.scss';
|
||||
|
||||
@@ -176,7 +176,6 @@ const preview: Preview = {
|
||||
'AI Observability',
|
||||
['Overview', 'Explorer', 'Model Pricing', 'Attribute Mapping'],
|
||||
'Noz',
|
||||
['Overview', 'Modal', 'Panel'],
|
||||
'Metering',
|
||||
['Cost Meter', 'Usage Explorer'],
|
||||
'Messaging Queues',
|
||||
@@ -197,9 +196,7 @@ const preview: Preview = {
|
||||
['Overview', 'Authz'],
|
||||
'Service Accounts',
|
||||
'Ingestion',
|
||||
['Overview', 'Authz'],
|
||||
'Single Sign-on',
|
||||
['Overview', 'Authz'],
|
||||
'Keyboard Shortcuts',
|
||||
],
|
||||
'Auth',
|
||||
|
||||
@@ -34,18 +34,14 @@ You are operating within a constrained context window and strict system prompts.
|
||||
- Identity keys (legend groups, color groups, CSV headers, React keys) come from structured values, never from joined display text: `['us, east', 'prod']` and `['us', 'east, prod']` both join to `us, east, prod`.
|
||||
- A payload saved under another kind or schema copies only the fields that schema accepts, and drops bindings to columns the user removed. The server rejects unknown or stale fields, so the preview works and the save fails.
|
||||
|
||||
3. CHECKS AT THE GATE: Your internal tools mark file writes as successful even if the code does not compile, so the checks below are required, but only at the gate. The gate is when the user says commit, push, raise or update the PR, mark it ready, or "run checks". Never run them after each edit or between the user's iterations.
|
||||
- Between gates, after an edit, run at most the one test file that covers it.
|
||||
- `no checks`: when the user says it (or "don't run tests", "just making changes"), run nothing: no tests, type check, lint, format or build. Make the change and stop. This holds until the user names a gate.
|
||||
|
||||
At the gate, you are FORBIDDEN from reporting a task as complete until you have:
|
||||
3. FORCED VERIFICATION: Your internal tools mark file writes as successful even if the code does not compile. Run these checks once all changes of a task are done, never after each edit. You are FORBIDDEN from reporting a task as complete until you have:
|
||||
- Run `pnpm tsgo --noEmit`
|
||||
- Run `pnpm lint:js --quiet` to find critical errors
|
||||
- Run `pnpm oxlint <file1> <file2>` and fix all warnings
|
||||
- Run `pnpm build`
|
||||
- Find if the file has tests for it, or if there's `__test__` folder or the parent folder has tests, and run. Run them before coding the change or after all changes, never in between.
|
||||
- For e2e, run only the specs you added or changed: the stack is heavy. Leave the full jest and e2e suites to CI unless the user asks.
|
||||
- For every test you added or changed, revert the change it covers and confirm the test fails, and that each test runs under 500 ms (`pnpm jest <file> --verbose`)
|
||||
- For every test you added or changed, revert the change it covers and confirm the test fails
|
||||
- On a stacked branch (`gh stack`), run `pnpm tsgo --noEmit` on every branch above it before pushing: a renamed prop or moved export breaks them
|
||||
- Fixed ALL resulting errors
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link rel="preconnect" href="https://cdn.vercel.com" crossorigin />
|
||||
|
||||
<title data-react-helmet="true">
|
||||
Open source Observability platform | SigNoz
|
||||
|
||||
@@ -11,16 +11,17 @@ const config: Config.InitialOptions = {
|
||||
coverageReporters: ['text', 'cobertura', 'html', 'json-summary'],
|
||||
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||
modulePathIgnorePatterns: ['<rootDir>/dist/'],
|
||||
modulePathIgnorePatterns: ['dist'],
|
||||
moduleNameMapper: {
|
||||
'\\.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff|wav)$':
|
||||
'\\.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)$':
|
||||
'<rootDir>/__mocks__/fileMock.ts',
|
||||
// The icon glob module uses `import.meta.glob` (Vite-only); jest can't parse
|
||||
// it, so redirect any import of it to a stub.
|
||||
'(^|/)iconAssets$': '<rootDir>/__mocks__/iconAssetsMock.ts',
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
'\\.(css|scss)$': '<rootDir>/__mocks__/cssMock.ts',
|
||||
'\\.(css|less|scss)$': '<rootDir>/__mocks__/cssMock.ts',
|
||||
'\\.module\\.mjs$': '<rootDir>/__mocks__/cssMock.ts',
|
||||
'\\.md$': '<rootDir>/__mocks__/cssMock.ts',
|
||||
'^uplot$': '<rootDir>/__mocks__/uplotMock.ts',
|
||||
'^motion/react$': '<rootDir>/__mocks__/motionMock.tsx',
|
||||
'^hooks/useSafeNavigate$': USE_SAFE_NAVIGATE_MOCK_PATH,
|
||||
@@ -55,18 +56,17 @@ const config: Config.InitialOptions = {
|
||||
},
|
||||
// TODO: https://github.com/SigNoz/engineering-pod/issues/5334
|
||||
transformIgnorePatterns: [
|
||||
// @chenglou/pretext is ESM-only; @signozhq/ui pulls it in via text-ellipsis.
|
||||
// Pattern 1: allow .pnpm virtual store through (handled by pattern 2), plus root-level ESM packages.
|
||||
'node_modules/(?!(\\.pnpm|react-json-tree|react-base16-styling|lodash-es|react-dnd|@react-dnd|dnd-core|react-dnd-html5-backend|axios|@signozhq/design-tokens|@signozhq|date-fns|d3-interpolate|d3-color|d3-geo|d3-array|internmap|ol|rbush|quickselect|earcut|@codemirror|@lezer|@marijn|@grafana|nuqs|uuid|react-markdown|vfile|vfile-message|unist-util-stringify-position|unified|bail|is-plain-obj|trough|remark-parse|remark-gfm|mdast-util-gfm|mdast-util-gfm-autolink-literal|mdast-util-gfm-footnote|mdast-util-gfm-strikethrough|mdast-util-gfm-table|mdast-util-gfm-task-list-item|mdast-util-find-and-replace|mdast-util-phrasing|mdast-util-to-markdown|markdown-table|longest-streak|ccount|escape-string-regexp|mdast-util-from-markdown|mdast-util-to-string|micromark|micromark-core-commonmark|micromark-extension-gfm|micromark-extension-gfm-autolink-literal|micromark-extension-gfm-footnote|micromark-extension-gfm-strikethrough|micromark-extension-gfm-table|micromark-extension-gfm-tagfilter|micromark-extension-gfm-task-list-item|micromark-factory-destination|micromark-factory-label|micromark-factory-space|micromark-factory-title|micromark-factory-whitespace|micromark-util-character|micromark-util-chunked|micromark-util-classify-character|micromark-util-combine-extensions|micromark-util-decode-numeric-character-reference|micromark-util-decode-string|micromark-util-encode|micromark-util-html-tag-name|micromark-util-normalize-identifier|micromark-util-resolve-all|micromark-util-sanitize-uri|micromark-util-subtokenize|micromark-util-symbol|micromark-util-types|decode-named-character-reference|remark-rehype|mdast-util-to-hast|unist-util-position|trim-lines|unist-util-visit|unist-util-visit-parents|unist-util-is|unist-util-generated|mdast-util-definitions|property-information|hast-util-whitespace|space-separated-tokens|comma-separated-tokens|rehype-raw|hast-util-raw|hast-util-from-parse5|devlop|hastscript|hast-util-parse-selector|vfile-location|web-namespaces|hast-util-to-parse5|zwitch|html-void-elements)/)',
|
||||
'node_modules/(?!(\\.pnpm|react-json-tree|react-base16-styling|lodash-es|react-dnd|core-dnd|@react-dnd|dnd-core|react-dnd-html5-backend|axios|@chenglou/pretext|@signozhq/design-tokens|@signozhq|date-fns|d3-interpolate|d3-color|d3-geo|d3-array|internmap|ol|rbush|quickselect|earcut|api|@codemirror|@lezer|@marijn|@grafana|nuqs|uuid|copy-text-to-clipboard|react-markdown|vfile|vfile-message|unist-util-stringify-position|unified|bail|is-plain-obj|trough|remark-parse|remark-gfm|mdast-util-gfm|mdast-util-gfm-autolink-literal|mdast-util-gfm-footnote|mdast-util-gfm-strikethrough|mdast-util-gfm-table|mdast-util-gfm-task-list-item|mdast-util-find-and-replace|mdast-util-phrasing|mdast-util-to-markdown|markdown-table|longest-streak|ccount|escape-string-regexp|mdast-util-from-markdown|mdast-util-to-string|micromark|micromark-core-commonmark|micromark-extension-gfm|micromark-extension-gfm-autolink-literal|micromark-extension-gfm-footnote|micromark-extension-gfm-strikethrough|micromark-extension-gfm-table|micromark-extension-gfm-tagfilter|micromark-extension-gfm-task-list-item|micromark-factory-destination|micromark-factory-label|micromark-factory-space|micromark-factory-title|micromark-factory-whitespace|micromark-util-character|micromark-util-chunked|micromark-util-classify-character|micromark-util-combine-extensions|micromark-util-decode-numeric-character-reference|micromark-util-decode-string|micromark-util-encode|micromark-util-html-tag-name|micromark-util-normalize-identifier|micromark-util-resolve-all|micromark-util-sanitize-uri|micromark-util-subtokenize|micromark-util-symbol|micromark-util-types|decode-named-character-reference|remark-rehype|mdast-util-to-hast|unist-util-position|trim-lines|unist-util-visit|unist-util-visit-parents|unist-util-is|unist-util-generated|mdast-util-definitions|property-information|hast-util-whitespace|space-separated-tokens|comma-separated-tokens|rehype-raw|hast-util-raw|hast-util-from-parse5|devlop|hastscript|hast-util-parse-selector|vfile-location|web-namespaces|hast-util-to-parse5|zwitch|html-void-elements)/)',
|
||||
// Pattern 2: pnpm virtual store — ignore everything except ESM-only packages.
|
||||
// pnpm encodes scoped packages as @scope+name@version, so match on scope prefix.
|
||||
'node_modules/\\.pnpm/(?!(react-json-tree|react-base16-styling|lodash-es|react-dnd|@react-dnd|dnd-core|react-dnd-html5-backend|axios|@signozhq|date-fns|d3-interpolate|d3-color|d3-geo|d3-array|internmap|ol|rbush|quickselect|earcut|@codemirror|@lezer|@marijn|@grafana|nuqs|uuid|react-markdown|vfile|vfile-message|unist-util-stringify-position|unified|bail|is-plain-obj|trough|remark-parse|remark-gfm|mdast-util-gfm|mdast-util-gfm-autolink-literal|mdast-util-gfm-footnote|mdast-util-gfm-strikethrough|mdast-util-gfm-table|mdast-util-gfm-task-list-item|mdast-util-find-and-replace|mdast-util-phrasing|mdast-util-to-markdown|markdown-table|longest-streak|ccount|escape-string-regexp|mdast-util-from-markdown|mdast-util-to-string|micromark|decode-named-character-reference|remark-rehype|mdast-util-to-hast|unist-util-position|trim-lines|unist-util-visit|unist-util-visit-parents|unist-util-is|unist-util-generated|mdast-util-definitions|property-information|hast-util-whitespace|space-separated-tokens|comma-separated-tokens|rehype-raw|hast-util-raw|hast-util-from-parse5|devlop|hastscript|hast-util-parse-selector|vfile-location|web-namespaces|hast-util-to-parse5|zwitch|html-void-elements)[^/]*/node_modules)',
|
||||
'node_modules/\\.pnpm/(?!(react-json-tree|react-base16-styling|lodash-es|react-dnd|core-dnd|@react-dnd|dnd-core|react-dnd-html5-backend|axios|@chenglou|@signozhq|date-fns|d3-interpolate|d3-color|d3-geo|d3-array|internmap|ol|rbush|quickselect|earcut|api|@codemirror|@lezer|@marijn|@grafana|nuqs|uuid|copy-text-to-clipboard|react-markdown|vfile|vfile-message|unist-util-stringify-position|unified|bail|is-plain-obj|trough|remark-parse|remark-gfm|mdast-util-gfm|mdast-util-gfm-autolink-literal|mdast-util-gfm-footnote|mdast-util-gfm-strikethrough|mdast-util-gfm-table|mdast-util-gfm-task-list-item|mdast-util-find-and-replace|mdast-util-phrasing|mdast-util-to-markdown|markdown-table|longest-streak|ccount|escape-string-regexp|mdast-util-from-markdown|mdast-util-to-string|micromark|decode-named-character-reference|remark-rehype|mdast-util-to-hast|unist-util-position|trim-lines|unist-util-visit|unist-util-visit-parents|unist-util-is|unist-util-generated|mdast-util-definitions|property-information|hast-util-whitespace|space-separated-tokens|comma-separated-tokens|rehype-raw|hast-util-raw|hast-util-from-parse5|devlop|hastscript|hast-util-parse-selector|vfile-location|web-namespaces|hast-util-to-parse5|zwitch|html-void-elements)[^/]*/node_modules)',
|
||||
],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
||||
testPathIgnorePatterns: ['/node_modules/', '/public/'],
|
||||
moduleDirectories: ['node_modules', 'src'],
|
||||
testEnvironment: '<rootDir>/jest.environment.cjs',
|
||||
// Local only: the default (cores - 1) workers exhaust RAM when several runs overlap.
|
||||
...(process.env.CI ? {} : { maxWorkers: 4, workerIdleMemoryLimit: '1GB' }),
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
statements: 80,
|
||||
|
||||
@@ -16,24 +16,6 @@ class JSDOMWithRequestEnvironment extends TestEnvironment {
|
||||
Object.defineProperty(this, 'signal', { value: signal ?? super.signal });
|
||||
}
|
||||
};
|
||||
|
||||
// Library CSS (antd's runtime styles, CodeMirror's theme, @signozhq/ui's
|
||||
// injected modules) stays out of the document, as the app's own stylesheets
|
||||
// already do through moduleNameMapper. jsdom matches every rule on each
|
||||
// getComputedStyle call, which made a role query take up to half a second.
|
||||
// rc-util adds and removes an empty style tag to find its container, so a
|
||||
// dropped tag must also be removable.
|
||||
const { Node, HTMLStyleElement, document } = this.global;
|
||||
for (const method of ['appendChild', 'insertBefore', 'removeChild']) {
|
||||
const original = Node.prototype[method];
|
||||
Node.prototype[method] = function (node, ...rest) {
|
||||
const isDroppedStyle =
|
||||
this === document.head &&
|
||||
node instanceof HTMLStyleElement &&
|
||||
node.parentNode !== this;
|
||||
return isDroppedStyle ? node : original.call(this, node, ...rest);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
import { TextDecoder, TextEncoder } from 'node:util';
|
||||
|
||||
import '@testing-library/jest-dom';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import 'jest-styled-components';
|
||||
|
||||
import { server } from './src/mocks-server/server';
|
||||
|
||||
import './src/styles.scss';
|
||||
// Establish API mocking before all tests.
|
||||
|
||||
// react-router@7's entry point pulls in its server-runtime cookie signing,
|
||||
@@ -37,21 +39,8 @@ if (!HTMLElement.prototype.scrollIntoView) {
|
||||
HTMLElement.prototype.scrollIntoView = function (): void {};
|
||||
}
|
||||
|
||||
// jsdom has no elementFromPoint; CodeMirror calls it on mousedown to place the cursor.
|
||||
if (!document.elementFromPoint) {
|
||||
document.elementFromPoint = (): Element | null => null;
|
||||
}
|
||||
|
||||
// jsdom Ranges have no layout; CodeMirror measures text through them on click.
|
||||
if (!Range.prototype.getClientRects) {
|
||||
Range.prototype.getClientRects = (): DOMRectList =>
|
||||
document.body.getClientRects();
|
||||
Range.prototype.getBoundingClientRect = (): DOMRect =>
|
||||
document.body.getBoundingClientRect();
|
||||
}
|
||||
|
||||
// jsdom doesn't implement the Pointer Capture API, which Base UI primitives
|
||||
// (e.g. @signozhq/ui Slider and Toast) call. Stub them so those components
|
||||
// jsdom doesn't implement the Pointer Capture API, which Radix UI primitives
|
||||
// (e.g. @signozhq/ui Select) call when opening. Stub them so those components
|
||||
// can be exercised in tests.
|
||||
if (!HTMLElement.prototype.hasPointerCapture) {
|
||||
HTMLElement.prototype.hasPointerCapture = function (): boolean {
|
||||
@@ -131,9 +120,29 @@ if (typeof globalThis.DOMRect === 'undefined') {
|
||||
};
|
||||
}
|
||||
|
||||
jest.mock('@testing-library/user-event', () =>
|
||||
jest.requireActual('tests/userEventWithDefaults'),
|
||||
);
|
||||
// Patch getComputedStyle to handle CSS parsing errors from @signozhq/* packages.
|
||||
// These packages inject CSS at import time via style-inject / vite-plugin-css-injected-by-js.
|
||||
// jsdom's nwsapi cannot parse some of the injected selectors (e.g. Tailwind's :animate-in),
|
||||
// causing SyntaxErrors during getComputedStyle / getByRole calls.
|
||||
const _origGetComputedStyle = window.getComputedStyle;
|
||||
window.getComputedStyle = function (
|
||||
elt: Element,
|
||||
pseudoElt?: string | null,
|
||||
): CSSStyleDeclaration {
|
||||
try {
|
||||
return _origGetComputedStyle.call(window, elt, pseudoElt);
|
||||
} catch {
|
||||
// Return a minimal CSSStyleDeclaration so callers (testing-library, Radix UI)
|
||||
// see the element as visible and without animations.
|
||||
return {
|
||||
display: '',
|
||||
visibility: '',
|
||||
opacity: '1',
|
||||
animationName: 'none',
|
||||
getPropertyValue: () => '',
|
||||
} as unknown as CSSStyleDeclaration;
|
||||
}
|
||||
};
|
||||
|
||||
beforeAll(() => server.listen());
|
||||
|
||||
|
||||
@@ -1,18 +1,8 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"entry": [
|
||||
"scripts/**/*.{mjs,cjs}",
|
||||
"src/storybook/mocks/*.mock.{ts,tsx}",
|
||||
"src/tests/userEventWithDefaults.ts"
|
||||
],
|
||||
"project": ["src/**/*.ts", "src/**/*.tsx"],
|
||||
"ignore": [
|
||||
"src/api/generated/**/*.ts",
|
||||
"src/typings/*.ts",
|
||||
"src/constants/generated/semconvFamilies.gen.ts",
|
||||
".storybook/public/**"
|
||||
],
|
||||
"ignore": ["src/api/generated/**/*.ts", "src/typings/*.ts"],
|
||||
"ignoreDependencies": [
|
||||
"@typescript/native-preview"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,7 @@
|
||||
"@sentry/vite-plugin": "5.3.0",
|
||||
"@signozhq/design-tokens": "2.8.0",
|
||||
"@signozhq/icons": "0.4.0",
|
||||
"@signozhq/noz-client": "1.13.0",
|
||||
"@signozhq/ui": "0.4.1-rc.2",
|
||||
"@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",
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import { ruleTester } from './rule-tester.mjs';
|
||||
|
||||
const message =
|
||||
'from lib/query/builderSlot instead of accessing builder_ai_query';
|
||||
|
||||
await ruleTester({
|
||||
rule: 'no-builder-ai-query-access',
|
||||
valid: [
|
||||
{
|
||||
name: 'reading through the slot helper',
|
||||
code: 'export const data = getActiveBuilder(query).queryData;',
|
||||
},
|
||||
{
|
||||
name: 'reading the builder slot',
|
||||
code: 'export const data = query.builder.queryData;',
|
||||
},
|
||||
{
|
||||
name: 'building a query with the AI slot',
|
||||
code: 'export const next = { ...query, builder_ai_query: builder };',
|
||||
},
|
||||
{
|
||||
name: 'generated enum member',
|
||||
code:
|
||||
'export const type = Querybuildertypesv5QueryTypeDTO.builder_ai_query;',
|
||||
},
|
||||
{
|
||||
name: 'type position',
|
||||
code: "export type Slot = Query['builder_ai_query'];",
|
||||
},
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
name: 'picking the slot by query type',
|
||||
code:
|
||||
'export const data =\n\tquery.queryType === EQueryType.AI_QUERY_BUILDER\n\t\t? query.builder_ai_query?.queryData\n\t\t: query.builder.queryData;',
|
||||
errors: [{ message, line: 3 }],
|
||||
},
|
||||
{
|
||||
name: 'optional chaining',
|
||||
code: 'export const slot = query?.builder_ai_query;',
|
||||
errors: [{ message, line: 1 }],
|
||||
},
|
||||
{
|
||||
name: 'writing the slot',
|
||||
code: 'query.builder_ai_query = builder;',
|
||||
errors: [{ message, line: 1 }],
|
||||
},
|
||||
{
|
||||
name: 'bracket access',
|
||||
code: "export const slot = query['builder_ai_query'];",
|
||||
errors: [{ message, line: 1 }],
|
||||
},
|
||||
{
|
||||
name: 'destructuring',
|
||||
code: 'export const { builder_ai_query: slot } = query;',
|
||||
errors: [{ message, line: 1 }],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -1,60 +0,0 @@
|
||||
import { ruleTester } from './rule-tester.mjs';
|
||||
|
||||
const message = (name) =>
|
||||
`Find elements through Testing Library (\`screen\`, \`within\`) instead of \`${name}\`.`;
|
||||
|
||||
await ruleTester({
|
||||
rule: 'no-dom-node-access',
|
||||
valid: [
|
||||
{
|
||||
name: 'Testing Library queries',
|
||||
code: "within(screen.getByTestId('row')).getByText('Name');",
|
||||
},
|
||||
{
|
||||
name: 'a query method that is not called',
|
||||
code:
|
||||
'jest.spyOn(document, "querySelector");\nconst q = Element.prototype.closest;',
|
||||
},
|
||||
{
|
||||
name: 'computed access',
|
||||
code: "const name = 'closest';\nel[name]('tr');",
|
||||
},
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
name: 'querySelector on the container',
|
||||
code: "container.querySelector('.row');",
|
||||
errors: [{ message: message('querySelector'), line: 1, column: 11 }],
|
||||
},
|
||||
{
|
||||
name: 'closest after a screen query',
|
||||
code: "screen.getByText('Name').closest('tr');",
|
||||
errors: [{ message: message('closest'), line: 1, column: 26 }],
|
||||
},
|
||||
{
|
||||
name: 'optional call',
|
||||
code: "row?.querySelectorAll('td');",
|
||||
errors: [{ message: message('querySelectorAll'), line: 1, column: 6 }],
|
||||
},
|
||||
{
|
||||
name: 'traversal property',
|
||||
code: 'expect(cell.parentElement).toBeVisible();',
|
||||
errors: [{ message: message('parentElement'), line: 1, column: 13 }],
|
||||
},
|
||||
{
|
||||
name: 'children of a DOM node',
|
||||
code: "expect(screen.getByTestId('list').children).toHaveLength(2);",
|
||||
errors: [{ message: message('children'), line: 1, column: 35 }],
|
||||
},
|
||||
{
|
||||
name: 'children of a data tree',
|
||||
code: 'expect(tree.children).toHaveLength(2);',
|
||||
errors: [{ message: message('children'), line: 1, column: 13 }],
|
||||
},
|
||||
{
|
||||
name: 'document lookup by id',
|
||||
code: "document.getElementById('root');",
|
||||
errors: [{ message: message('getElementById'), line: 1, column: 10 }],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -17,7 +17,8 @@ const BANNED_COMPONENTS = {
|
||||
Typography:
|
||||
'Use @signozhq/ui/typography Typography instead of antd Typography.',
|
||||
Switch: 'Use @signozhq/ui/switch Switch instead of antd Switch.',
|
||||
Dropdown: 'Use @signozhq/ui/dropdown Dropdown instead of antd Dropdown.',
|
||||
Dropdown:
|
||||
'Use @signozhq/ui DropdownMenuSimple (or the composable DropdownMenu primitives) from @signozhq/ui/dropdown-menu instead of antd Dropdown.',
|
||||
Badge: 'Use @signozhq/ui/badge instead of antd Badge.',
|
||||
Radio:
|
||||
'Use @signozhq/ui/radio-group RadioGroup (dots) or @signozhq/ui/toggle-group ToggleGroup (segmented buttons) instead of antd Radio.',
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
const SLOT = 'builder_ai_query';
|
||||
|
||||
function isSlotKey(key, computed) {
|
||||
if (key.type === 'Literal') {
|
||||
return key.value === SLOT;
|
||||
}
|
||||
return !computed && key.type === 'Identifier' && key.name === SLOT;
|
||||
}
|
||||
|
||||
// Generated enums like Querybuildertypesv5QueryTypeDTO.builder_ai_query are not queries
|
||||
function isGeneratedEnum(object) {
|
||||
return object.type === 'Identifier' && /^[A-Z]/.test(object.name);
|
||||
}
|
||||
|
||||
export default {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description:
|
||||
'Disallow direct builder_ai_query access; use the lib/query/builderSlot helpers',
|
||||
category: 'Query Builder',
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
useSlotHelper:
|
||||
'Use getActiveBuilder, getBuilderBySlotKey or replaceBuilderBySlotKey from lib/query/builderSlot instead of accessing builder_ai_query directly.',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if (
|
||||
isSlotKey(node.property, node.computed) &&
|
||||
!isGeneratedEnum(node.object)
|
||||
) {
|
||||
context.report({ node, messageId: 'useSlotHelper' });
|
||||
}
|
||||
},
|
||||
ObjectPattern(node) {
|
||||
node.properties.forEach((property) => {
|
||||
if (
|
||||
property.type === 'Property' &&
|
||||
isSlotKey(property.key, property.computed)
|
||||
) {
|
||||
context.report({ node: property, messageId: 'useSlotHelper' });
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
/**
|
||||
* Rule: no-dom-node-access
|
||||
*
|
||||
* Tests find elements through Testing Library (`screen`, `within`), not by
|
||||
* walking the DOM. Flags calls to DOM query methods and reads of node
|
||||
* traversal properties:
|
||||
* container.querySelector('.row')
|
||||
* screen.getByText('Name').closest('tr')
|
||||
* cell.parentElement
|
||||
* list.children
|
||||
*
|
||||
* A non-DOM `children` read (a data tree, React props) disables the rule on
|
||||
* that line with a reason.
|
||||
*/
|
||||
|
||||
const QUERY_METHODS = new Set([
|
||||
'querySelector',
|
||||
'querySelectorAll',
|
||||
'closest',
|
||||
'getElementById',
|
||||
'getElementsByClassName',
|
||||
'getElementsByTagName',
|
||||
'getElementsByName',
|
||||
]);
|
||||
|
||||
const TRAVERSAL_PROPERTIES = new Set([
|
||||
'parentElement',
|
||||
'parentNode',
|
||||
'firstChild',
|
||||
'lastChild',
|
||||
'firstElementChild',
|
||||
'lastElementChild',
|
||||
'nextSibling',
|
||||
'previousSibling',
|
||||
'nextElementSibling',
|
||||
'previousElementSibling',
|
||||
'childNodes',
|
||||
'children',
|
||||
]);
|
||||
|
||||
export default {
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if (node.computed || node.property.type !== 'Identifier') {
|
||||
return;
|
||||
}
|
||||
const { name } = node.property;
|
||||
const isCall =
|
||||
node.parent?.type === 'CallExpression' && node.parent.callee === node;
|
||||
if ((isCall && QUERY_METHODS.has(name)) || TRAVERSAL_PROPERTIES.has(name)) {
|
||||
context.report({
|
||||
node: node.property,
|
||||
message: `Find elements through Testing Library (\`screen\`, \`within\`) instead of \`${name}\`.`,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -12,10 +12,10 @@
|
||||
* And expects:
|
||||
* import { Typography } from '@signozhq/ui/typography'
|
||||
* import { Button } from '@signozhq/ui/button'
|
||||
* import { toast } from '@signozhq/ui/toast'
|
||||
* import { toast } from '@signozhq/ui/sonner'
|
||||
*
|
||||
* Why: the barrel eagerly require()s every component along with their
|
||||
* Base UI/react-day-picker dependencies. Under Jest this caused
|
||||
* Why: the barrel eagerly require()s every component (~90 of them) along with
|
||||
* their Radix/cmdk/motion/react-day-picker dependencies. Under Jest this caused
|
||||
* 5s timeouts and flaky tests after the Antd→@signozhq/ui Typography migration
|
||||
* (#11199). Subpath imports (added in @signozhq/ui@0.0.18) load only what's
|
||||
* used.
|
||||
@@ -198,7 +198,7 @@ export default {
|
||||
const report = {
|
||||
node: node.source,
|
||||
message:
|
||||
"Do not import from the '@signozhq/ui' barrel. Use the matching subpath instead (e.g. '@signozhq/ui/typography', '@signozhq/ui/button', '@signozhq/ui/toast'). The barrel eagerly loads every component and slows tests substantially.",
|
||||
"Do not import from the '@signozhq/ui' barrel. Use the matching subpath instead (e.g. '@signozhq/ui/typography', '@signozhq/ui/button', '@signozhq/ui/sonner'). The barrel eagerly loads ~90 components and slows tests substantially.",
|
||||
};
|
||||
if (replacement) {
|
||||
report.fix = (fixer) => fixer.replaceText(node, replacement);
|
||||
|
||||
@@ -19,8 +19,6 @@ 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';
|
||||
import noDomNodeAccess from './rules/no-dom-node-access.mjs';
|
||||
import noBuilderAiQueryAccess from './rules/no-builder-ai-query-access.mjs';
|
||||
|
||||
export default {
|
||||
meta: {
|
||||
@@ -41,7 +39,5 @@ export default {
|
||||
'no-direct-react-router-import': noDirectReactRouterImport,
|
||||
'no-text-css': noTextCss,
|
||||
'require-disable-reason': requireDisableReason,
|
||||
'no-dom-node-access': noDomNodeAccess,
|
||||
'no-builder-ai-query-access': noBuilderAiQueryAccess,
|
||||
},
|
||||
};
|
||||
|
||||
26
frontend/pnpm-lock.yaml
generated
@@ -82,12 +82,9 @@ importers:
|
||||
'@signozhq/icons':
|
||||
specifier: 0.4.0
|
||||
version: 0.4.0
|
||||
'@signozhq/noz-client':
|
||||
specifier: 1.13.0
|
||||
version: 1.13.0(axios@1.21.1)(react-query@3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0)
|
||||
'@signozhq/ui':
|
||||
specifier: 0.4.1-rc.2
|
||||
version: 0.4.1-rc.2(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
specifier: 0.4.0-rc.5
|
||||
version: 0.4.0-rc.5(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@tanstack/react-table':
|
||||
specifier: 8.21.3
|
||||
version: 8.21.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
@@ -3251,15 +3248,8 @@ packages:
|
||||
'@signozhq/icons@0.4.0':
|
||||
resolution: {integrity: sha512-QctNvNPlQlsefFdIVmSy/P/7a1IcQ3IryKP0KPMqtoqew3q89FGUmFa5IfEJ7Z3CHhtG1zaXwBKqP72QkLyA3g==}
|
||||
|
||||
'@signozhq/noz-client@1.13.0':
|
||||
resolution: {integrity: sha512-130L2xomHnQZK8ZtAst34qFz9d2rSF/JYpg9gKvJkZVS9+46CPZeTW8Va9PNS9Oa5owezVHIXZStTEbsHIxnwg==}
|
||||
peerDependencies:
|
||||
axios: ^1.20.0
|
||||
react: ^18.2.0
|
||||
react-query: ^3.39.3
|
||||
|
||||
'@signozhq/ui@0.4.1-rc.2':
|
||||
resolution: {integrity: sha512-pCMRzrJ6CmGjEgAQ2B6wRRengP2sy7Y860Npr5nkCapc9NPH5jy4VO48CDv5gnKwWSKShmLHwzbiK2E1cGndKQ==}
|
||||
'@signozhq/ui@0.4.0-rc.5':
|
||||
resolution: {integrity: sha512-WlJMfeDfvL2hjMpTpHhhND/tuK7X0sfXQlx6E1ZG+6E/DYHpuhYljfvW3E6/BohIlHFlTyCs/ZMl9wnV2k9Zcw==}
|
||||
peerDependencies:
|
||||
'@signozhq/design-tokens': '>=2.7.0'
|
||||
'@signozhq/icons': 0.3.0
|
||||
@@ -12383,13 +12373,7 @@ snapshots:
|
||||
|
||||
'@signozhq/icons@0.4.0': {}
|
||||
|
||||
'@signozhq/noz-client@1.13.0(axios@1.21.1)(react-query@3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
axios: 1.21.1
|
||||
react: 18.2.0
|
||||
react-query: 3.39.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
|
||||
'@signozhq/ui@0.4.1-rc.2(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
'@signozhq/ui@0.4.0-rc.5(@date-fns/tz@1.4.1)(@signozhq/design-tokens@2.8.0)(@signozhq/icons@0.4.0)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)':
|
||||
dependencies:
|
||||
'@base-ui/react': 1.8.0(@date-fns/tz@1.4.1)(@types/react@18.0.26)(date-fns@4.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||
'@signozhq/design-tokens': 2.8.0
|
||||
|
||||
@@ -117,8 +117,6 @@
|
||||
"log_based_alert_desc": "Send a notification when a condition occurs in the logs data.",
|
||||
"traces_based_alert": "Trace-based Alert",
|
||||
"traces_based_alert_desc": "Send a notification when a condition occurs in the traces data.",
|
||||
"ai_traces_based_alert": "AI Trace-based Alert",
|
||||
"ai_traces_based_alert_desc": "Send a notification when a condition occurs in AI and LLM traces.",
|
||||
"exceptions_based_alert": "Exceptions-based Alert",
|
||||
"exceptions_based_alert_desc": "Send a notification when a condition occurs in the exceptions data.",
|
||||
"field_unit": "Threshold unit",
|
||||
|
||||
@@ -121,8 +121,6 @@
|
||||
"log_based_alert_desc": "Send a notification when a condition occurs in the logs data.",
|
||||
"traces_based_alert": "Trace-based Alert",
|
||||
"traces_based_alert_desc": "Send a notification when a condition occurs in the traces data.",
|
||||
"ai_traces_based_alert": "AI Trace-based Alert",
|
||||
"ai_traces_based_alert_desc": "Send a notification when a condition occurs in AI and LLM traces.",
|
||||
"exceptions_based_alert": "Exceptions-based Alert",
|
||||
"exceptions_based_alert_desc": "Send a notification when a condition occurs in the exceptions data.",
|
||||
"field_unit": "Threshold unit",
|
||||
|
||||
@@ -28,6 +28,4 @@ until curl -sf http://127.0.0.1:6006/index.json >/dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# The first story of a heavy page compiles it on the cold dev server inside its
|
||||
# own test, which outlasts 30s on a loaded runner.
|
||||
pnpm exec test-storybook --ci --maxWorkers=2 --testTimeout 60000 "$@"
|
||||
pnpm exec test-storybook --ci --maxWorkers=2 --testTimeout 30000 "$@"
|
||||
|
||||
@@ -175,8 +175,8 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
||||
pathname === ROUTES.SETTINGS ||
|
||||
pathname === ROUTES.BILLING ||
|
||||
pathname === ROUTES.MEMBERS_SETTINGS ||
|
||||
pathname === ROUTES.ORG_SETTINGS ||
|
||||
(isAdmin && pathname === ROUTES.MY_SETTINGS);
|
||||
(isAdmin &&
|
||||
(pathname === ROUTES.ORG_SETTINGS || pathname === ROUTES.MY_SETTINGS));
|
||||
|
||||
if (
|
||||
pathname !== ROUTES.WORKSPACE_LOCKED &&
|
||||
|
||||
@@ -808,7 +808,7 @@ describe('PrivateRoute', () => {
|
||||
assertStaysOnRoute(ROUTES.BILLING);
|
||||
});
|
||||
|
||||
it('should allow VIEWER to access org-settings when workspace is blocked', () => {
|
||||
it('should redirect VIEWER to workspace locked when trying to access org-settings', async () => {
|
||||
renderPrivateRoute({
|
||||
initialRoute: ROUTES.ORG_SETTINGS,
|
||||
appContext: {
|
||||
@@ -821,7 +821,7 @@ describe('PrivateRoute', () => {
|
||||
isCloudUser: true,
|
||||
});
|
||||
|
||||
assertStaysOnRoute(ROUTES.ORG_SETTINGS);
|
||||
await assertRedirectsTo(ROUTES.WORKSPACE_LOCKED);
|
||||
});
|
||||
|
||||
it('should allow VIEWER to access members settings when workspace is blocked', () => {
|
||||
@@ -1707,7 +1707,6 @@ describe('PrivateRoute', () => {
|
||||
// Everything under /settings resolves to the non-exact SETTINGS route
|
||||
SETTINGS: { path: ROUTES.SETTINGS, deniedRoles: DENIED_ROLES },
|
||||
MY_SETTINGS: { path: ROUTES.MY_SETTINGS, deniedRoles: DENIED_ROLES },
|
||||
ORG_SETTINGS: { path: ROUTES.ORG_SETTINGS, deniedRoles: DENIED_ROLES },
|
||||
ROLES_SETTINGS: { path: ROUTES.ROLES_SETTINGS, deniedRoles: DENIED_ROLES },
|
||||
ROLE_CREATE: { path: ROUTES.ROLE_CREATE, deniedRoles: DENIED_ROLES },
|
||||
ROLE_DETAILS: {
|
||||
|
||||
@@ -129,6 +129,18 @@ export const StatusPage = Loadable(
|
||||
() => import(/* webpackChunkName: "All Status" */ 'pages/Status'),
|
||||
);
|
||||
|
||||
export const OrganizationSettings = Loadable(
|
||||
() => import(/* webpackChunkName: "All Settings" */ 'pages/Settings'),
|
||||
);
|
||||
|
||||
export const IngestionSettings = Loadable(
|
||||
() => import(/* webpackChunkName: "Ingestion Settings" */ 'pages/Settings'),
|
||||
);
|
||||
|
||||
export const MySettings = Loadable(
|
||||
() => import(/* webpackChunkName: "All MySettings" */ 'pages/Settings'),
|
||||
);
|
||||
|
||||
export const Logs = Loadable(
|
||||
() => import(/* webpackChunkName: "Logs" */ 'pages/LogsModulePage'),
|
||||
);
|
||||
@@ -169,6 +181,10 @@ export const LogsIndexToFields = Loadable(
|
||||
import(/* webpackChunkName: "LogsIndexToFields Page" */ 'pages/LogsSettings'),
|
||||
);
|
||||
|
||||
export const BillingPage = Loadable(
|
||||
() => import(/* webpackChunkName: "BillingPage" */ 'pages/Settings'),
|
||||
);
|
||||
|
||||
export const SupportPage = Loadable(
|
||||
() => import(/* webpackChunkName: "SupportPage" */ 'pages/Support'),
|
||||
);
|
||||
@@ -192,6 +208,10 @@ export const WorkspaceAccessRestricted = Loadable(
|
||||
),
|
||||
);
|
||||
|
||||
export const ShortcutsPage = Loadable(
|
||||
() => import(/* webpackChunkName: "ShortcutsPage" */ 'pages/Settings'),
|
||||
);
|
||||
|
||||
export const Integrations = Loadable(
|
||||
() =>
|
||||
import(
|
||||
@@ -210,6 +230,13 @@ export const MessagingQueuesMainPage = Loadable(
|
||||
import(/* webpackChunkName: "MessagingQueues" */ 'pages/MessagingQueues'),
|
||||
);
|
||||
|
||||
export const MQDetailPage = Loadable(
|
||||
() =>
|
||||
import(
|
||||
/* webpackChunkName: "MQDetailPage" */ 'pages/MessagingQueues/MQDetailPage'
|
||||
),
|
||||
);
|
||||
|
||||
export const InfrastructureMonitoring = Loadable(
|
||||
() =>
|
||||
import(
|
||||
@@ -217,6 +244,20 @@ export const InfrastructureMonitoring = Loadable(
|
||||
),
|
||||
);
|
||||
|
||||
export const CeleryTask = Loadable(
|
||||
() =>
|
||||
import(
|
||||
/* webpackChunkName: "CeleryTask" */ 'pages/Celery/CeleryTask/CeleryTask'
|
||||
),
|
||||
);
|
||||
|
||||
export const CeleryOverview = Loadable(
|
||||
() =>
|
||||
import(
|
||||
/* webpackChunkName: "CeleryOverview" */ 'pages/Celery/CeleryOverview/CeleryOverview'
|
||||
),
|
||||
);
|
||||
|
||||
export const MetricsExplorer = Loadable(
|
||||
() =>
|
||||
import(/* webpackChunkName: "MetricsExplorer" */ 'pages/MetricsExplorer'),
|
||||
|
||||
@@ -321,8 +321,8 @@ const createTracesResponse = ({
|
||||
httpMethod: trace.httpMethod ?? httpMethods[index % httpMethods.length],
|
||||
responseStatusCode:
|
||||
trace.responseStatusCode ?? statusCodes[index % statusCodes.length],
|
||||
trace_id: `trace-id-${index}`,
|
||||
span_id: `span-id-${index}`,
|
||||
traceID: `trace-id-${index}`,
|
||||
spanID: `span-id-${index}`,
|
||||
},
|
||||
};
|
||||
})
|
||||
@@ -340,8 +340,8 @@ const createTracesResponse = ({
|
||||
durationNano: 1000000 + cumulativeIndex * 100000,
|
||||
httpMethod: httpMethods[cumulativeIndex % httpMethods.length],
|
||||
responseStatusCode: statusCodes[cumulativeIndex % statusCodes.length],
|
||||
trace_id: `trace-id-${cumulativeIndex}`,
|
||||
span_id: `span-id-${cumulativeIndex}`,
|
||||
traceID: `trace-id-${cumulativeIndex}`,
|
||||
spanID: `span-id-${cumulativeIndex}`,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* to resume, which each return a new executionId to open a fresh SSE stream.
|
||||
*
|
||||
* Types in this file re-use the OpenAPI-generated DTOs in
|
||||
* `@signozhq/noz-client`.
|
||||
* `src/api/ai-assistant/sigNozAIAssistantAPI.schemas.ts`.
|
||||
* Local types are defined only when the UI needs a different shape — for
|
||||
* example, the SSE event union adds a literal `type` discriminator that the
|
||||
* generated event DTOs leave loose.
|
||||
@@ -30,26 +30,37 @@ import rotateSession from 'api/v2/sessions/rotate/post';
|
||||
import afterLogin from 'AppRoutes/utils';
|
||||
import type {
|
||||
ActionResultResponseDTO,
|
||||
ApprovalEventDTO,
|
||||
ApproveResponseDTO,
|
||||
CancelResponseDTO,
|
||||
ClarificationEventDTO,
|
||||
ClarifyResponseDTO,
|
||||
ConversationEventDTO,
|
||||
CreateMessageResponseDTO,
|
||||
CreateThreadResponseDTO,
|
||||
DoneEventDTO,
|
||||
ErrorEventDTO,
|
||||
ExecutionStateDTO,
|
||||
FeedbackRatingDTO,
|
||||
ListThreadsApiV1AssistantThreadsGetArchived,
|
||||
ListThreadsApiV1AssistantThreadsGetParams,
|
||||
MessageContextDTO,
|
||||
MessageContextDTOSource,
|
||||
MessageContextDTOType,
|
||||
MessageEventDTO,
|
||||
MessageSummaryDTO,
|
||||
RegenerateResponseDTO,
|
||||
StatusEventDTO,
|
||||
ThinkingEventDTO,
|
||||
ThreadDetailResponseDTO,
|
||||
ThreadListResponseDTO,
|
||||
ThreadSummaryDTO,
|
||||
ChipDTO,
|
||||
ChipsResponseDTO,
|
||||
PageTypeDTO,
|
||||
} from '@signozhq/noz-client';
|
||||
ToolCallEventDTO,
|
||||
ToolResultEventDTO,
|
||||
} from './sigNozAIAssistantAPI.schemas';
|
||||
import { LOCALSTORAGE } from 'constants/localStorage';
|
||||
|
||||
import {
|
||||
@@ -59,10 +70,6 @@ import {
|
||||
} from '../AIAPIInstance';
|
||||
import { getSigNozInstanceUrl } from 'utils/signozInstanceUrl';
|
||||
|
||||
import type { SSEEvent } from './sseEvent';
|
||||
|
||||
export type { SSEEvent };
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE-only auth wrapper.
|
||||
//
|
||||
@@ -176,6 +183,29 @@ async function fetchSSEWithAuth(
|
||||
return res;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE event types
|
||||
//
|
||||
// The generated event DTOs each declare `type?: string` (loose). The UI needs
|
||||
// a discriminated union, so we intersect each variant with a string-literal
|
||||
// `type` to enable narrowing via `event.type === 'status'`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type SSEEvent =
|
||||
| (StatusEventDTO & { type: 'status' })
|
||||
| (MessageEventDTO & { type: 'message' })
|
||||
| (ThinkingEventDTO & { type: 'thinking' })
|
||||
| (ToolCallEventDTO & { type: 'tool_call' })
|
||||
| (ToolResultEventDTO & { type: 'tool_result' })
|
||||
| (ApprovalEventDTO & { type: 'approval' })
|
||||
| (ClarificationEventDTO & { type: 'clarification' })
|
||||
| (ErrorEventDTO & { type: 'error' })
|
||||
| (ConversationEventDTO & { type: 'conversation' })
|
||||
| (DoneEventDTO & { type: 'done' });
|
||||
|
||||
/** String-literal view of `ExecutionStateDTO` for ergonomic comparisons. */
|
||||
export type ExecutionState = `${ExecutionStateDTO}`;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Re-exported DTOs — the wire shape, used directly without remapping.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
1998
frontend/src/api/ai-assistant/index.ts
Normal file
1520
frontend/src/api/ai-assistant/sigNozAIAssistantAPI.schemas.ts
Normal file
@@ -1,32 +0,0 @@
|
||||
import type {
|
||||
ApprovalEventDTO,
|
||||
ClarificationEventDTO,
|
||||
ConversationEventDTO,
|
||||
DoneEventDTO,
|
||||
ErrorEventDTO,
|
||||
MessageEventDTO,
|
||||
StatusEventDTO,
|
||||
ThinkingEventDTO,
|
||||
ToolCallEventDTO,
|
||||
ToolResultEventDTO,
|
||||
} from '@signozhq/noz-client';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SSE event types
|
||||
//
|
||||
// The generated event DTOs each declare `type?: string` (loose). The UI needs
|
||||
// a discriminated union, so we intersect each variant with a string-literal
|
||||
// `type` to enable narrowing via `event.type === 'status'`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export type SSEEvent =
|
||||
| (StatusEventDTO & { type: 'status' })
|
||||
| (MessageEventDTO & { type: 'message' })
|
||||
| (ThinkingEventDTO & { type: 'thinking' })
|
||||
| (ToolCallEventDTO & { type: 'tool_call' })
|
||||
| (ToolResultEventDTO & { type: 'tool_result' })
|
||||
| (ApprovalEventDTO & { type: 'approval' })
|
||||
| (ClarificationEventDTO & { type: 'clarification' })
|
||||
| (ErrorEventDTO & { type: 'error' })
|
||||
| (ConversationEventDTO & { type: 'conversation' })
|
||||
| (DoneEventDTO & { type: 'done' });
|
||||
34
frontend/src/api/alerts/getTriggered.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import axios from 'api';
|
||||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||
import { AxiosError } from 'axios';
|
||||
import convertObjectIntoParams from 'lib/query/convertObjectIntoParams';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import { PayloadProps, Props } from 'types/api/alerts/getTriggered';
|
||||
|
||||
/**
|
||||
* @deprecated Use the generated `useGetAlerts` hook (or `getAlerts` fetcher) from
|
||||
* `api/generated/services/alerts` instead. This hand-written client targets the
|
||||
* same endpoint and will be removed once call sites migrate.
|
||||
*
|
||||
* Part of https://github.com/SigNoz/engineering-pod/issues/5289, add a comment or update when removing this method.
|
||||
*/
|
||||
const getTriggered = async (
|
||||
props: Props,
|
||||
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
||||
try {
|
||||
const queryParams = convertObjectIntoParams(props);
|
||||
|
||||
const response = await axios.get(`/alerts?${queryParams}`);
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: response.data.status,
|
||||
payload: response.data.data,
|
||||
};
|
||||
} catch (error) {
|
||||
return ErrorResponseHandler(error as AxiosError);
|
||||
}
|
||||
};
|
||||
|
||||
export default getTriggered;
|
||||
@@ -17,11 +17,13 @@ function loadGetModule(href: string): GetModule {
|
||||
// oxlint-disable-next-line typescript-eslint/no-require-imports, typescript-eslint/no-var-requires
|
||||
mod = require('../get');
|
||||
});
|
||||
base.remove();
|
||||
return mod;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const el of document.head.querySelectorAll('base')) {
|
||||
el.remove();
|
||||
}
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
|
||||
@@ -15,11 +15,13 @@ function loadGetModule(href: string): GetModule {
|
||||
// oxlint-disable-next-line typescript-eslint/no-require-imports, typescript-eslint/no-var-requires
|
||||
mod = require('../get');
|
||||
});
|
||||
base.remove();
|
||||
return mod;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const el of document.head.querySelectorAll('base')) {
|
||||
el.remove();
|
||||
}
|
||||
sessionStorage.clear();
|
||||
});
|
||||
|
||||
|
||||
@@ -14204,7 +14204,19 @@ export interface SpantypesTraceAITokensDTO {
|
||||
}
|
||||
|
||||
export interface SpantypesTraceAISummaryDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of LLM calls: spans with gen_ai.request.model.
|
||||
*/
|
||||
llmCallCount: number;
|
||||
tokens: SpantypesTraceAITokensDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of tool call spans: spans with gen_ai.tool.name.
|
||||
*/
|
||||
toolCallCount: number;
|
||||
/**
|
||||
* @type number
|
||||
*/
|
||||
@@ -14266,24 +14278,53 @@ export interface SpantypesOtelSpanRefDTO {
|
||||
traceId?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
export type SpantypesThreadSpanDTOAttributes = { [key: string]: unknown };
|
||||
|
||||
/**
|
||||
* Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
export type SpantypesThreadSpanDTOResource = { [key: string]: string };
|
||||
|
||||
export interface SpantypesThreadSpanDTO {
|
||||
/**
|
||||
* @type object
|
||||
* @description Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
attributes: SpantypesThreadSpanDTOAttributes;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database name. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_name?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database operation. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_operation?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Duration, in nanoseconds.
|
||||
*/
|
||||
duration_nano: number;
|
||||
/**
|
||||
* @type array
|
||||
* @description Span events. A span read by ID has all of them; a span in a list has none.
|
||||
*/
|
||||
events: SpantypesEventDTO[];
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Host of the URL of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_url?: string;
|
||||
formattedInput: AiobservabilitytypesInputMessagesDTO;
|
||||
formattedOutput: AiobservabilitytypesOutputMessagesDTO;
|
||||
/**
|
||||
@@ -14292,10 +14333,27 @@ export interface SpantypesThreadSpanDTO {
|
||||
formatterWarnings: string[];
|
||||
/**
|
||||
* @type boolean
|
||||
* @description Whether the span is marked as an error.
|
||||
*/
|
||||
has_error: boolean;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP host or server address. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_host?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request URL. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_url?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Span kind, for example Server, Client or Internal.
|
||||
*/
|
||||
kind_string: string;
|
||||
/**
|
||||
@@ -14304,37 +14362,57 @@ export interface SpantypesThreadSpanDTO {
|
||||
name: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description ID of the parent span. Empty for a root.
|
||||
*/
|
||||
parent_span_id: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description References to other spans: the parent as CHILD_OF, and each span link as FOLLOWS_FROM.
|
||||
*/
|
||||
references: SpantypesOtelSpanRefDTO[];
|
||||
/**
|
||||
* @type object
|
||||
* @description Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
resource: SpantypesThreadSpanDTOResource;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP or gRPC status code of the response, for example 404. Empty when the span has none.
|
||||
*/
|
||||
response_status_code: string;
|
||||
/**
|
||||
* @description Instrumentation scope. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
scope?: SpantypesScopeDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
span_id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description OpenTelemetry status code of the span.
|
||||
*/
|
||||
status_code_string: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Status message, usually the error text. Empty when the span has none.
|
||||
*/
|
||||
status_message: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Start time, in milliseconds since the Unix epoch.
|
||||
*/
|
||||
time_unix: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
trace_id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description W3C trace state. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
trace_state?: string;
|
||||
}
|
||||
|
||||
export interface SpantypesGettableTraceThreadDTO {
|
||||
@@ -14352,57 +14430,58 @@ export interface SpantypesGettableTraceThreadDTO {
|
||||
spans: SpantypesThreadSpanDTO[];
|
||||
}
|
||||
|
||||
export type SpantypesWaterfallSpanDTOAttributesAnyOf = {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
/**
|
||||
* Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
export type SpantypesWaterfallSpanDTOAttributes = { [key: string]: unknown };
|
||||
|
||||
/**
|
||||
* @nullable
|
||||
* Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
export type SpantypesWaterfallSpanDTOAttributes = SpantypesWaterfallSpanDTOAttributesAnyOf | null;
|
||||
|
||||
export type SpantypesWaterfallSpanDTOResourceAnyOf = { [key: string]: string };
|
||||
|
||||
/**
|
||||
* @nullable
|
||||
*/
|
||||
export type SpantypesWaterfallSpanDTOResource = SpantypesWaterfallSpanDTOResourceAnyOf | null;
|
||||
export type SpantypesWaterfallSpanDTOResource = { [key: string]: string };
|
||||
|
||||
export interface SpantypesWaterfallSpanDTO {
|
||||
/**
|
||||
* @type object,null
|
||||
* @type object
|
||||
* @description Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
attributes?: SpantypesWaterfallSpanDTOAttributes;
|
||||
attributes: SpantypesWaterfallSpanDTOAttributes;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database name. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_name?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database operation. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_operation?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Duration, in nanoseconds.
|
||||
*/
|
||||
duration_nano?: number;
|
||||
duration_nano: number;
|
||||
/**
|
||||
* @type array,null
|
||||
* @type array
|
||||
* @description Span events. A span read by ID has all of them; a span in a list has none.
|
||||
*/
|
||||
events?: SpantypesEventDTO[] | null;
|
||||
events: SpantypesEventDTO[];
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Host of the URL of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_url?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
flags?: number;
|
||||
flags: number;
|
||||
formattedInput?: AiobservabilitytypesInputMessagesDTO;
|
||||
formattedOutput?: AiobservabilitytypesOutputMessagesDTO;
|
||||
/**
|
||||
@@ -14412,89 +14491,105 @@ export interface SpantypesWaterfallSpanDTO {
|
||||
/**
|
||||
* @type boolean
|
||||
*/
|
||||
has_children?: boolean;
|
||||
has_children: boolean;
|
||||
/**
|
||||
* @type boolean
|
||||
* @description Whether the span is marked as an error.
|
||||
*/
|
||||
has_error?: boolean;
|
||||
has_error: boolean;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP host or server address. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_host?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request URL. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_url?: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
is_remote?: string;
|
||||
is_remote: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Span kind, for example Server, Client or Internal.
|
||||
*/
|
||||
kind_string?: string;
|
||||
kind_string: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
level?: number;
|
||||
level: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
name?: string;
|
||||
name: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description ID of the parent span. Empty for a root.
|
||||
*/
|
||||
parent_span_id?: string;
|
||||
parent_span_id: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description References to other spans: the parent as CHILD_OF, and each span link as FOLLOWS_FROM.
|
||||
*/
|
||||
references: SpantypesOtelSpanRefDTO[];
|
||||
/**
|
||||
* @type object,null
|
||||
* @type object
|
||||
* @description Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
resource?: SpantypesWaterfallSpanDTOResource;
|
||||
resource: SpantypesWaterfallSpanDTOResource;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP or gRPC status code of the response, for example 404. Empty when the span has none.
|
||||
*/
|
||||
response_status_code: string;
|
||||
/**
|
||||
* @description Instrumentation scope. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
response_status_code?: string;
|
||||
scope?: SpantypesScopeDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
span_id?: string;
|
||||
span_id: string;
|
||||
/**
|
||||
* @type integer
|
||||
*/
|
||||
status_code?: number;
|
||||
/**
|
||||
* @type string
|
||||
* @description OpenTelemetry status code of the span.
|
||||
*/
|
||||
status_code_string?: string;
|
||||
status_code_string: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Status message, usually the error text. Empty when the span has none.
|
||||
*/
|
||||
status_message?: string;
|
||||
status_message: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
*/
|
||||
sub_tree_node_count?: number;
|
||||
sub_tree_node_count: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Start time, in milliseconds since the Unix epoch.
|
||||
*/
|
||||
time_unix?: number;
|
||||
time_unix: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
trace_id?: string;
|
||||
trace_id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description W3C trace state. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
trace_state?: string;
|
||||
}
|
||||
@@ -14632,6 +14727,310 @@ export interface SpantypesPostableWaterfallDTO {
|
||||
uncollapsedSpans?: string[] | null;
|
||||
}
|
||||
|
||||
export interface SpantypesSameNameSiblingStatsDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans in the group that are marked as errors.
|
||||
*/
|
||||
errorSpanCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Total own time of the group, in nanoseconds.
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans in the group, this span included.
|
||||
*/
|
||||
spanCount: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
export type SpantypesSpanDTOAttributes = { [key: string]: unknown };
|
||||
|
||||
/**
|
||||
* Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
export type SpantypesSpanDTOResource = { [key: string]: string };
|
||||
|
||||
export interface SpantypesSpanDTO {
|
||||
/**
|
||||
* @type object
|
||||
* @description Span attributes. A span read by ID has all of them; a span in a list has only the selected ones.
|
||||
*/
|
||||
attributes: SpantypesSpanDTOAttributes;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database name. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_name?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Database operation. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
db_operation?: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Duration, in nanoseconds.
|
||||
*/
|
||||
duration_nano: number;
|
||||
/**
|
||||
* @type array
|
||||
* @description Span events. A span read by ID has all of them; a span in a list has none.
|
||||
*/
|
||||
events: SpantypesEventDTO[];
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Host of the URL of an outgoing call. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
external_http_url?: string;
|
||||
/**
|
||||
* @type boolean
|
||||
* @description Whether the span is marked as an error.
|
||||
*/
|
||||
has_error: boolean;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP host or server address. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_host?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request method. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_method?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP request URL. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
http_url?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Span kind, for example Server, Client or Internal.
|
||||
*/
|
||||
kind_string: string;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description ID of the parent span. Empty for a root.
|
||||
*/
|
||||
parent_span_id: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description References to other spans: the parent as CHILD_OF, and each span link as FOLLOWS_FROM.
|
||||
*/
|
||||
references: SpantypesOtelSpanRefDTO[];
|
||||
/**
|
||||
* @type object
|
||||
* @description Resource attributes. Always includes service.name. A span read by ID has all of them; a span in a list also has the selected ones.
|
||||
*/
|
||||
resource: SpantypesSpanDTOResource;
|
||||
/**
|
||||
* @type string
|
||||
* @description HTTP or gRPC status code of the response, for example 404. Empty when the span has none.
|
||||
*/
|
||||
response_status_code: string;
|
||||
/**
|
||||
* @description Instrumentation scope. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
scope?: SpantypesScopeDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
span_id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description OpenTelemetry status code of the span.
|
||||
*/
|
||||
status_code_string: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description Status message, usually the error text. Empty when the span has none.
|
||||
*/
|
||||
status_message: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Start time, in milliseconds since the Unix epoch.
|
||||
*/
|
||||
time_unix: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
trace_id: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description W3C trace state. Left out when the span has none, and in a list unless selected.
|
||||
*/
|
||||
trace_state?: string;
|
||||
}
|
||||
|
||||
export interface SpantypesSpanTextMatchDTO {
|
||||
/**
|
||||
* @type string
|
||||
* @description Where the word was found: name, status_message, an attribute as attributes.<name> (for example attributes.http.route), a resource attribute as resource.<name> (for example resource.service.name), or an event by its position as events[<index>] (for example events[0]).
|
||||
*/
|
||||
field: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description The text around the word, about 40 characters on each side, for example: Worldpay declined the card.
|
||||
*/
|
||||
snippet: string;
|
||||
}
|
||||
|
||||
export interface SpantypesSpanTreeStatsDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of direct children.
|
||||
*/
|
||||
childCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of ancestors in a row, starting at the parent, that are marked as errors. On an error span it shows how far up the error spread.
|
||||
*/
|
||||
errorAncestorCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Depth in the trace: 0 for a root, 1 for its children, and so on.
|
||||
*/
|
||||
level: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Time spent in the span itself, in nanoseconds: its duration minus the time its children cover.
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
/**
|
||||
* @description Totals for the spans that share this span's name and parent, this span included. Omitted when no other span does.
|
||||
*/
|
||||
sameNameSiblings?: SpantypesSameNameSiblingStatsDTO;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans below this one, at any depth.
|
||||
*/
|
||||
subtreeSpanCount: number;
|
||||
}
|
||||
|
||||
export enum SpantypesUnmarkedFailureKindDTO {
|
||||
http_4xx = 'http_4xx',
|
||||
http_5xx = 'http_5xx',
|
||||
grpc_status = 'grpc_status',
|
||||
exception_event = 'exception_event',
|
||||
}
|
||||
export interface SpantypesSpanItemDTO {
|
||||
/**
|
||||
* @type array
|
||||
* @description Where the words of the query were found, up to three places. A list does not return all attributes or any events, so this is how to see why a span matched. Omitted when the query has no words.
|
||||
*/
|
||||
matches?: SpantypesSpanTextMatchDTO[];
|
||||
span: SpantypesSpanDTO;
|
||||
/**
|
||||
* @description Numbers computed from the span's place in the trace.
|
||||
*/
|
||||
treeStats: SpantypesSpanTreeStatsDTO;
|
||||
/**
|
||||
* @description Why the span is in the unmarked_failures list: a 4xx or 5xx response (http_4xx, http_5xx), a gRPC status other than OK (grpc_status), or an exception event (exception_event). Omitted for every other span.
|
||||
*/
|
||||
unmarkedFailureKind?: SpantypesUnmarkedFailureKindDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesSpanListDTO {
|
||||
/**
|
||||
* @type array
|
||||
* @description The spans of this page.
|
||||
*/
|
||||
items: SpantypesSpanItemDTO[];
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans that match the request, across all pages.
|
||||
*/
|
||||
total: number;
|
||||
/**
|
||||
* @type array
|
||||
* @description Reasons the result may be incomplete, for example a query key that is not known or a selected field that no returned span has. Omitted when there are none.
|
||||
*/
|
||||
warnings?: string[];
|
||||
}
|
||||
|
||||
export enum SpantypesSpanListViewDTO {
|
||||
error_origins = 'error_origins',
|
||||
unmarked_failures = 'unmarked_failures',
|
||||
time_spent = 'time_spent',
|
||||
ai_usage = 'ai_usage',
|
||||
links = 'links',
|
||||
}
|
||||
export interface SpantypesTraceServiceStatsDTO {
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans of the service that are marked as errors.
|
||||
*/
|
||||
errorSpanCount: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Total own time of the service's spans, in nanoseconds.
|
||||
*/
|
||||
ownTimeNano: number;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
serviceName: string;
|
||||
/**
|
||||
* @type integer
|
||||
* @minimum 0
|
||||
* @description Number of spans of the service.
|
||||
*/
|
||||
spanCount: number;
|
||||
}
|
||||
|
||||
export interface SpantypesTraceHighlightsDTO {
|
||||
/**
|
||||
* @description The spans with the highest gen_ai cost or token usage. First page of the ai_usage view of the span list. Empty for a trace where no span carries that usage.
|
||||
*/
|
||||
aiUsage?: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @description The spans where an error started. First page of the error_origins view of the span list.
|
||||
*/
|
||||
errorOrigins?: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @description Spans that link to other spans. First page of the links view of the span list.
|
||||
*/
|
||||
links?: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @type array
|
||||
* @description Totals for each service of the trace, highest own time first.
|
||||
*/
|
||||
services: SpantypesTraceServiceStatsDTO[];
|
||||
/**
|
||||
* @description Where the time went, same-name siblings counted as one. First page of the time_spent view of the span list.
|
||||
*/
|
||||
timeSpent?: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @description Spans that are not marked as errors but report a 4xx or 5xx response, a gRPC status other than OK, or an exception event. First page of the unmarked_failures view of the span list.
|
||||
*/
|
||||
unmarkedFailures?: SpantypesSpanListDTO;
|
||||
}
|
||||
|
||||
export interface SpantypesUpdatableSpanMapperDTO {
|
||||
config?: SpantypesSpanMapperConfigDTO;
|
||||
/**
|
||||
@@ -15619,7 +16018,7 @@ export type GetFieldsValuesParams = {
|
||||
searchText?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description The key whose values to return, such as service.name. With fieldContext set, it is the stored name as is. Otherwise a context prefix such as resource.service.name sets the context and a type suffix such as service.name:string sets fieldDataType when that is empty; as in filter expressions, a prefixed name also matches a key stored under the full name, whose values come first: log.level returns values of a key named log.level, then of the log field level.
|
||||
* @description The key whose values to return, such as service.name. A context prefix such as resource.service.name sets fieldContext when it is empty.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
@@ -16097,6 +16496,197 @@ export type GetTraceAggregations200 = {
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type GetTraceHighlightsPathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
export type GetTraceHighlightsParams = {
|
||||
/**
|
||||
* @type array
|
||||
* @description The lists to return, each named by its view. Default: all of them.
|
||||
*/
|
||||
views?: SpantypesSpanListViewDTO[];
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans in each list. Default: 10. Maximum: 1000.
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type GetTraceHighlights200 = {
|
||||
data: SpantypesTraceHighlightsDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type ListTraceSpansPathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
export type ListTraceSpansParams = {
|
||||
/**
|
||||
* @description A quick filter on the spans the route covers. Without it every span the route covers is returned, in the route's own order. With it only the spans of that kind are returned, in that kind's order. Whether a span is of a kind is decided on the whole trace, not only on the spans that matched query. error_origins: the spans where an error started, meaning error spans with no failing child, by start time. unmarked_failures: spans that are not marked as errors but report a 4xx or 5xx response, a gRPC status other than OK, or an exception event, by start time. time_spent: one span for each group of same-name siblings, by the group's total own time. ai_usage: the spans that carry gen_ai token or cost usage, by cost, or by tokens when none has a cost; each includes those attributes. links: the spans that link to other spans, by start time.
|
||||
*/
|
||||
view?: SpantypesSpanListViewDTO;
|
||||
/**
|
||||
* @type string
|
||||
* @description Returns only the spans that match. Takes words, a filter expression, or both, for example: worldpay AND has_error = true. Words are matched, ignoring case, against the span name, status message, attributes, resource attributes and events. A filter expression uses the keys of a span, such as kind_string or has_error. When view is also given, query is applied first, and the view then keeps the spans of its kind among the ones that matched.
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description Attributes and resource attributes to include on each span, for example http.route or resource.k8s.pod.name. Without it a span includes only service.name. A field that no returned span has is listed in warnings.
|
||||
*/
|
||||
selectFields?: string[];
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to skip. Default: 0.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to return. Default: 50. Maximum: 1000.
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type ListTraceSpans200 = {
|
||||
data: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type GetTraceSpanPathParameters = {
|
||||
traceID: string;
|
||||
spanID: string;
|
||||
};
|
||||
export type GetTraceSpan200 = {
|
||||
data: SpantypesSpanDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type ListTraceSpanAncestorsPathParameters = {
|
||||
traceID: string;
|
||||
spanID: string;
|
||||
};
|
||||
export type ListTraceSpanAncestorsParams = {
|
||||
/**
|
||||
* @description A quick filter on the spans the route covers. Without it every span the route covers is returned, in the route's own order. With it only the spans of that kind are returned, in that kind's order. Whether a span is of a kind is decided on the whole trace, not only on the spans that matched query. error_origins: the spans where an error started, meaning error spans with no failing child, by start time. unmarked_failures: spans that are not marked as errors but report a 4xx or 5xx response, a gRPC status other than OK, or an exception event, by start time. time_spent: one span for each group of same-name siblings, by the group's total own time. ai_usage: the spans that carry gen_ai token or cost usage, by cost, or by tokens when none has a cost; each includes those attributes. links: the spans that link to other spans, by start time.
|
||||
*/
|
||||
view?: SpantypesSpanListViewDTO;
|
||||
/**
|
||||
* @type string
|
||||
* @description Returns only the spans that match. Takes words, a filter expression, or both, for example: worldpay AND has_error = true. Words are matched, ignoring case, against the span name, status message, attributes, resource attributes and events. A filter expression uses the keys of a span, such as kind_string or has_error. When view is also given, query is applied first, and the view then keeps the spans of its kind among the ones that matched.
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description Attributes and resource attributes to include on each span, for example http.route or resource.k8s.pod.name. Without it a span includes only service.name. A field that no returned span has is listed in warnings.
|
||||
*/
|
||||
selectFields?: string[];
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to skip. Default: 0.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to return. Default: 50. Maximum: 1000.
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type ListTraceSpanAncestors200 = {
|
||||
data: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type ListTraceSpanChildrenPathParameters = {
|
||||
traceID: string;
|
||||
spanID: string;
|
||||
};
|
||||
export type ListTraceSpanChildrenParams = {
|
||||
/**
|
||||
* @description A quick filter on the spans the route covers. Without it every span the route covers is returned, in the route's own order. With it only the spans of that kind are returned, in that kind's order. Whether a span is of a kind is decided on the whole trace, not only on the spans that matched query. error_origins: the spans where an error started, meaning error spans with no failing child, by start time. unmarked_failures: spans that are not marked as errors but report a 4xx or 5xx response, a gRPC status other than OK, or an exception event, by start time. time_spent: one span for each group of same-name siblings, by the group's total own time. ai_usage: the spans that carry gen_ai token or cost usage, by cost, or by tokens when none has a cost; each includes those attributes. links: the spans that link to other spans, by start time.
|
||||
*/
|
||||
view?: SpantypesSpanListViewDTO;
|
||||
/**
|
||||
* @type string
|
||||
* @description Returns only the spans that match. Takes words, a filter expression, or both, for example: worldpay AND has_error = true. Words are matched, ignoring case, against the span name, status message, attributes, resource attributes and events. A filter expression uses the keys of a span, such as kind_string or has_error. When view is also given, query is applied first, and the view then keeps the spans of its kind among the ones that matched.
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description Attributes and resource attributes to include on each span, for example http.route or resource.k8s.pod.name. Without it a span includes only service.name. A field that no returned span has is listed in warnings.
|
||||
*/
|
||||
selectFields?: string[];
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to skip. Default: 0.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to return. Default: 50. Maximum: 1000.
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type ListTraceSpanChildren200 = {
|
||||
data: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type ListTraceSpanDescendantsPathParameters = {
|
||||
traceID: string;
|
||||
spanID: string;
|
||||
};
|
||||
export type ListTraceSpanDescendantsParams = {
|
||||
/**
|
||||
* @description A quick filter on the spans the route covers. Without it every span the route covers is returned, in the route's own order. With it only the spans of that kind are returned, in that kind's order. Whether a span is of a kind is decided on the whole trace, not only on the spans that matched query. error_origins: the spans where an error started, meaning error spans with no failing child, by start time. unmarked_failures: spans that are not marked as errors but report a 4xx or 5xx response, a gRPC status other than OK, or an exception event, by start time. time_spent: one span for each group of same-name siblings, by the group's total own time. ai_usage: the spans that carry gen_ai token or cost usage, by cost, or by tokens when none has a cost; each includes those attributes. links: the spans that link to other spans, by start time.
|
||||
*/
|
||||
view?: SpantypesSpanListViewDTO;
|
||||
/**
|
||||
* @type string
|
||||
* @description Returns only the spans that match. Takes words, a filter expression, or both, for example: worldpay AND has_error = true. Words are matched, ignoring case, against the span name, status message, attributes, resource attributes and events. A filter expression uses the keys of a span, such as kind_string or has_error. When view is also given, query is applied first, and the view then keeps the spans of its kind among the ones that matched.
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* @type array
|
||||
* @description Attributes and resource attributes to include on each span, for example http.route or resource.k8s.pod.name. Without it a span includes only service.name. A field that no returned span has is listed in warnings.
|
||||
*/
|
||||
selectFields?: string[];
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to skip. Default: 0.
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* @type integer
|
||||
* @description Number of spans to return. Default: 50. Maximum: 1000.
|
||||
*/
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export type ListTraceSpanDescendants200 = {
|
||||
data: SpantypesSpanListDTO;
|
||||
/**
|
||||
* @type string
|
||||
*/
|
||||
status: string;
|
||||
};
|
||||
|
||||
export type GetTraceSummaryPathParameters = {
|
||||
traceID: string;
|
||||
};
|
||||
@@ -17236,7 +17826,7 @@ export type GetRuleHistoryFilterValuesParams = {
|
||||
searchText?: string;
|
||||
/**
|
||||
* @type string
|
||||
* @description The key whose values to return, such as service.name. With fieldContext set, it is the stored name as is. Otherwise a context prefix such as resource.service.name sets the context and a type suffix such as service.name:string sets fieldDataType when that is empty; as in filter expressions, a prefixed name also matches a key stored under the full name, whose values come first: log.level returns values of a key named log.level, then of the log field level.
|
||||
* @description The key whose values to return, such as service.name. A context prefix such as resource.service.name sets fieldContext when it is empty.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,11 @@ import type {
|
||||
GetFlamegraphPathParameters,
|
||||
GetTraceAggregations200,
|
||||
GetTraceAggregationsPathParameters,
|
||||
GetTraceHighlights200,
|
||||
GetTraceHighlightsParams,
|
||||
GetTraceHighlightsPathParameters,
|
||||
GetTraceSpan200,
|
||||
GetTraceSpanPathParameters,
|
||||
GetTraceSummary200,
|
||||
GetTraceSummaryPathParameters,
|
||||
GetTraceThread200,
|
||||
@@ -29,6 +34,18 @@ import type {
|
||||
GetTraceThreadPathParameters,
|
||||
GetWaterfallV4200,
|
||||
GetWaterfallV4PathParameters,
|
||||
ListTraceSpanAncestors200,
|
||||
ListTraceSpanAncestorsParams,
|
||||
ListTraceSpanAncestorsPathParameters,
|
||||
ListTraceSpanChildren200,
|
||||
ListTraceSpanChildrenParams,
|
||||
ListTraceSpanChildrenPathParameters,
|
||||
ListTraceSpanDescendants200,
|
||||
ListTraceSpanDescendantsParams,
|
||||
ListTraceSpanDescendantsPathParameters,
|
||||
ListTraceSpans200,
|
||||
ListTraceSpansParams,
|
||||
ListTraceSpansPathParameters,
|
||||
RenderErrorResponseDTO,
|
||||
SpantypesPostableFlamegraphDTO,
|
||||
SpantypesPostableTraceAggregationsDTO,
|
||||
@@ -159,7 +176,710 @@ export const useGetTraceAggregations = <
|
||||
return useMutation(getGetTraceAggregationsMutationOptions(options));
|
||||
};
|
||||
/**
|
||||
* Returns the trace's time range, root span, span and error counts, and whether any spans are missing. AI traces also include token and cost totals.
|
||||
* Returns the spans to look at, for a trace of any size: per-service totals and the first spans of each view of the span list. views names the lists to return; without it all of them are returned. Read more of a list from the span list with the view of the same name. The totals of the trace come from the trace summary.
|
||||
* @summary Get highlights of a trace
|
||||
*/
|
||||
export const getTraceHighlights = (
|
||||
{ traceID }: GetTraceHighlightsPathParameters,
|
||||
params?: GetTraceHighlightsParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<GetTraceHighlights200>({
|
||||
url: `/api/v1/traces/${traceID}/highlights`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetTraceHighlightsQueryKey = (
|
||||
{ traceID }: GetTraceHighlightsPathParameters,
|
||||
params?: GetTraceHighlightsParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/highlights`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getGetTraceHighlightsQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof getTraceHighlights>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: GetTraceHighlightsPathParameters,
|
||||
params?: GetTraceHighlightsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceHighlights>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getGetTraceHighlightsQueryKey({ traceID }, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof getTraceHighlights>>
|
||||
> = ({ signal }) => getTraceHighlights({ traceID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: traceID !== null && traceID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceHighlights>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type GetTraceHighlightsQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getTraceHighlights>>
|
||||
>;
|
||||
export type GetTraceHighlightsQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary Get highlights of a trace
|
||||
*/
|
||||
|
||||
export function useGetTraceHighlights<
|
||||
TData = Awaited<ReturnType<typeof getTraceHighlights>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: GetTraceHighlightsPathParameters,
|
||||
params?: GetTraceHighlightsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceHighlights>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getGetTraceHighlightsQueryOptions(
|
||||
{ traceID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get highlights of a trace
|
||||
*/
|
||||
export const invalidateGetTraceHighlights = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID }: GetTraceHighlightsPathParameters,
|
||||
params?: GetTraceHighlightsParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getGetTraceHighlightsQueryKey({ traceID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a page of the spans of a trace, in tree order from the top: a span is followed by the spans below it. view keeps only the spans of one kind, query narrows them, and selectFields names the attributes to fill. Values are returned whole.
|
||||
* @summary List spans of a trace
|
||||
*/
|
||||
export const listTraceSpans = (
|
||||
{ traceID }: ListTraceSpansPathParameters,
|
||||
params?: ListTraceSpansParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListTraceSpans200>({
|
||||
url: `/api/v1/traces/${traceID}/spans`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getListTraceSpansQueryKey = (
|
||||
{ traceID }: ListTraceSpansPathParameters,
|
||||
params?: ListTraceSpansParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/spans`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListTraceSpansQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listTraceSpans>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: ListTraceSpansPathParameters,
|
||||
params?: ListTraceSpansParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getListTraceSpansQueryKey({ traceID }, params);
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof listTraceSpans>>> = ({
|
||||
signal,
|
||||
}) => listTraceSpans({ traceID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled: traceID !== null && traceID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type ListTraceSpansQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listTraceSpans>>
|
||||
>;
|
||||
export type ListTraceSpansQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary List spans of a trace
|
||||
*/
|
||||
|
||||
export function useListTraceSpans<
|
||||
TData = Awaited<ReturnType<typeof listTraceSpans>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID }: ListTraceSpansPathParameters,
|
||||
params?: ListTraceSpansParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpans>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getListTraceSpansQueryOptions(
|
||||
{ traceID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List spans of a trace
|
||||
*/
|
||||
export const invalidateListTraceSpans = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID }: ListTraceSpansPathParameters,
|
||||
params?: ListTraceSpansParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getListTraceSpansQueryKey({ traceID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns one span with every attribute, resource attribute and event. Values are returned whole. It returns only the stored span: its tree stats come with it in any span list, and the spans around it come from the children, descendants and ancestors routes.
|
||||
* @summary Get span of a trace
|
||||
*/
|
||||
export const getTraceSpan = (
|
||||
{ traceID, spanID }: GetTraceSpanPathParameters,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<GetTraceSpan200>({
|
||||
url: `/api/v1/traces/${traceID}/spans/${spanID}`,
|
||||
method: 'GET',
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getGetTraceSpanQueryKey = ({
|
||||
traceID,
|
||||
spanID,
|
||||
}: GetTraceSpanPathParameters) => {
|
||||
return [`/api/v1/traces/${traceID}/spans/${spanID}`] as const;
|
||||
};
|
||||
|
||||
export const getGetTraceSpanQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof getTraceSpan>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: GetTraceSpanPathParameters,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ?? getGetTraceSpanQueryKey({ traceID, spanID });
|
||||
|
||||
const queryFn: QueryFunction<Awaited<ReturnType<typeof getTraceSpan>>> = ({
|
||||
signal,
|
||||
}) => getTraceSpan({ traceID, spanID }, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled:
|
||||
traceID !== null &&
|
||||
traceID !== undefined &&
|
||||
spanID !== null &&
|
||||
spanID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type GetTraceSpanQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof getTraceSpan>>
|
||||
>;
|
||||
export type GetTraceSpanQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary Get span of a trace
|
||||
*/
|
||||
|
||||
export function useGetTraceSpan<
|
||||
TData = Awaited<ReturnType<typeof getTraceSpan>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: GetTraceSpanPathParameters,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof getTraceSpan>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getGetTraceSpanQueryOptions({ traceID, spanID }, options);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get span of a trace
|
||||
*/
|
||||
export const invalidateGetTraceSpan = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID, spanID }: GetTraceSpanPathParameters,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getGetTraceSpanQueryKey({ traceID, spanID }) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a page of the spans above a span: the chain of parents from the span up to its root, the parent first, and nothing from other branches. The span itself is not included. It takes the same parameters as the span list. The list is empty for a root, and stops where a parent was never received.
|
||||
* @summary List ancestors of a span
|
||||
*/
|
||||
export const listTraceSpanAncestors = (
|
||||
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
|
||||
params?: ListTraceSpanAncestorsParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListTraceSpanAncestors200>({
|
||||
url: `/api/v1/traces/${traceID}/spans/${spanID}/ancestors`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getListTraceSpanAncestorsQueryKey = (
|
||||
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
|
||||
params?: ListTraceSpanAncestorsParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/spans/${spanID}/ancestors`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListTraceSpanAncestorsQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanAncestors>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
|
||||
params?: ListTraceSpanAncestorsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getListTraceSpanAncestorsQueryKey({ traceID, spanID }, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listTraceSpanAncestors>>
|
||||
> = ({ signal }) =>
|
||||
listTraceSpanAncestors({ traceID, spanID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled:
|
||||
traceID !== null &&
|
||||
traceID !== undefined &&
|
||||
spanID !== null &&
|
||||
spanID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type ListTraceSpanAncestorsQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listTraceSpanAncestors>>
|
||||
>;
|
||||
export type ListTraceSpanAncestorsQueryError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary List ancestors of a span
|
||||
*/
|
||||
|
||||
export function useListTraceSpanAncestors<
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanAncestors>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
|
||||
params?: ListTraceSpanAncestorsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanAncestors>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getListTraceSpanAncestorsQueryOptions(
|
||||
{ traceID, spanID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List ancestors of a span
|
||||
*/
|
||||
export const invalidateListTraceSpanAncestors = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID, spanID }: ListTraceSpanAncestorsPathParameters,
|
||||
params?: ListTraceSpanAncestorsParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getListTraceSpanAncestorsQueryKey({ traceID, spanID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a page of the direct children of a span, one level below it and nothing deeper, in start order. It takes the same parameters as the span list. The list is empty for a span without children.
|
||||
* @summary List children of a span
|
||||
*/
|
||||
export const listTraceSpanChildren = (
|
||||
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
|
||||
params?: ListTraceSpanChildrenParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListTraceSpanChildren200>({
|
||||
url: `/api/v1/traces/${traceID}/spans/${spanID}/children`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getListTraceSpanChildrenQueryKey = (
|
||||
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
|
||||
params?: ListTraceSpanChildrenParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/spans/${spanID}/children`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListTraceSpanChildrenQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanChildren>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
|
||||
params?: ListTraceSpanChildrenParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanChildren>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getListTraceSpanChildrenQueryKey({ traceID, spanID }, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listTraceSpanChildren>>
|
||||
> = ({ signal }) => listTraceSpanChildren({ traceID, spanID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled:
|
||||
traceID !== null &&
|
||||
traceID !== undefined &&
|
||||
spanID !== null &&
|
||||
spanID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanChildren>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type ListTraceSpanChildrenQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listTraceSpanChildren>>
|
||||
>;
|
||||
export type ListTraceSpanChildrenQueryError = ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary List children of a span
|
||||
*/
|
||||
|
||||
export function useListTraceSpanChildren<
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanChildren>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
|
||||
params?: ListTraceSpanChildrenParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanChildren>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getListTraceSpanChildrenQueryOptions(
|
||||
{ traceID, spanID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List children of a span
|
||||
*/
|
||||
export const invalidateListTraceSpanChildren = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID, spanID }: ListTraceSpanChildrenPathParameters,
|
||||
params?: ListTraceSpanChildrenParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{ queryKey: getListTraceSpanChildrenQueryKey({ traceID, spanID }, params) },
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a page of the spans below a span, at any depth, in tree order. It takes the same parameters as the span list, so view=error_origins returns the errors that started below the span.
|
||||
* @summary List descendants of a span
|
||||
*/
|
||||
export const listTraceSpanDescendants = (
|
||||
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
|
||||
params?: ListTraceSpanDescendantsParams,
|
||||
signal?: AbortSignal,
|
||||
) => {
|
||||
return GeneratedAPIInstance<ListTraceSpanDescendants200>({
|
||||
url: `/api/v1/traces/${traceID}/spans/${spanID}/descendants`,
|
||||
method: 'GET',
|
||||
params,
|
||||
signal,
|
||||
});
|
||||
};
|
||||
|
||||
export const getListTraceSpanDescendantsQueryKey = (
|
||||
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
|
||||
params?: ListTraceSpanDescendantsParams,
|
||||
) => {
|
||||
return [
|
||||
`/api/v1/traces/${traceID}/spans/${spanID}/descendants`,
|
||||
...(params ? [params] : []),
|
||||
] as const;
|
||||
};
|
||||
|
||||
export const getListTraceSpanDescendantsQueryOptions = <
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanDescendants>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
|
||||
params?: ListTraceSpanDescendantsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
) => {
|
||||
const { query: queryOptions } = options ?? {};
|
||||
|
||||
const queryKey =
|
||||
queryOptions?.queryKey ??
|
||||
getListTraceSpanDescendantsQueryKey({ traceID, spanID }, params);
|
||||
|
||||
const queryFn: QueryFunction<
|
||||
Awaited<ReturnType<typeof listTraceSpanDescendants>>
|
||||
> = ({ signal }) =>
|
||||
listTraceSpanDescendants({ traceID, spanID }, params, signal);
|
||||
|
||||
return {
|
||||
queryKey,
|
||||
queryFn,
|
||||
enabled:
|
||||
traceID !== null &&
|
||||
traceID !== undefined &&
|
||||
spanID !== null &&
|
||||
spanID !== undefined,
|
||||
...queryOptions,
|
||||
} as UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
|
||||
TError,
|
||||
TData
|
||||
> & { queryKey: QueryKey };
|
||||
};
|
||||
|
||||
export type ListTraceSpanDescendantsQueryResult = NonNullable<
|
||||
Awaited<ReturnType<typeof listTraceSpanDescendants>>
|
||||
>;
|
||||
export type ListTraceSpanDescendantsQueryError =
|
||||
ErrorType<RenderErrorResponseDTO>;
|
||||
|
||||
/**
|
||||
* @summary List descendants of a span
|
||||
*/
|
||||
|
||||
export function useListTraceSpanDescendants<
|
||||
TData = Awaited<ReturnType<typeof listTraceSpanDescendants>>,
|
||||
TError = ErrorType<RenderErrorResponseDTO>,
|
||||
>(
|
||||
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
|
||||
params?: ListTraceSpanDescendantsParams,
|
||||
options?: {
|
||||
query?: UseQueryOptions<
|
||||
Awaited<ReturnType<typeof listTraceSpanDescendants>>,
|
||||
TError,
|
||||
TData
|
||||
>;
|
||||
},
|
||||
): UseQueryResult<TData, TError> & { queryKey: QueryKey } {
|
||||
const queryOptions = getListTraceSpanDescendantsQueryOptions(
|
||||
{ traceID, spanID },
|
||||
params,
|
||||
options,
|
||||
);
|
||||
|
||||
const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & {
|
||||
queryKey: QueryKey;
|
||||
};
|
||||
|
||||
return withQueryKey(query, queryOptions.queryKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary List descendants of a span
|
||||
*/
|
||||
export const invalidateListTraceSpanDescendants = async (
|
||||
queryClient: QueryClient,
|
||||
{ traceID, spanID }: ListTraceSpanDescendantsPathParameters,
|
||||
params?: ListTraceSpanDescendantsParams,
|
||||
options?: InvalidateOptions,
|
||||
): Promise<QueryClient> => {
|
||||
await queryClient.invalidateQueries(
|
||||
{
|
||||
queryKey: getListTraceSpanDescendantsQueryKey({ traceID, spanID }, params),
|
||||
},
|
||||
options,
|
||||
);
|
||||
|
||||
return queryClient;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the totals of a trace and no spans: its time range, root span, span and error counts, and whether any spans are missing. AI traces also include model and tool call counts, and token and cost totals. For the spans to look at, use the trace highlights.
|
||||
* @summary Get summary for a trace
|
||||
*/
|
||||
export const getTraceSummary = (
|
||||
@@ -261,7 +981,7 @@ export const invalidateGetTraceSummary = async (
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the gen_ai spans of a trace, model calls, tool calls and agent spans, in timestamp order. The messages a span carries are decoded into formattedInput and formattedOutput, with formatterWarnings holding what the converter could not resolve; a span without messages has both empty. Pass nextCursor as after or prevCursor as before to page, or spanId to open the page around a span.
|
||||
* Returns the gen_ai spans of a trace, LLM calls, tool calls and agent spans, in timestamp order. The messages a span carries are decoded into formattedInput and formattedOutput, with formatterWarnings holding what the converter could not resolve; a span without messages has both empty. Pass nextCursor as after or prevCursor as before to page, or spanId to open the page around a span.
|
||||
* @summary Get thread view for a trace
|
||||
*/
|
||||
export const getTraceThread = (
|
||||
|
||||
@@ -15,6 +15,37 @@ const generatedAPIAxiosInstance = axios.create({
|
||||
paramsSerializer: { indexes: null },
|
||||
});
|
||||
|
||||
let generatedAPIQueryKeyHeaderContext: Record<string, unknown> | undefined;
|
||||
|
||||
export const setGeneratedAPIQueryKeyHeaderContext = <THeaders extends object>(
|
||||
headers?: THeaders,
|
||||
): void => {
|
||||
generatedAPIQueryKeyHeaderContext = headers
|
||||
? { ...(headers as Record<string, unknown>) }
|
||||
: undefined;
|
||||
};
|
||||
|
||||
const hashHeaderValue = (value: string): string => {
|
||||
let hash = 0;
|
||||
|
||||
for (let index = 0; index < value.length; index += 1) {
|
||||
hash = (hash * 31 + value.charCodeAt(index)) >>> 0;
|
||||
}
|
||||
|
||||
return hash.toString(16);
|
||||
};
|
||||
|
||||
const mergeHeaderRecord = (
|
||||
target: Record<string, unknown>,
|
||||
source: unknown,
|
||||
): Record<string, unknown> => {
|
||||
if (!source || typeof source !== 'object') {
|
||||
return target;
|
||||
}
|
||||
|
||||
return Object.assign(target, source as Record<string, unknown>);
|
||||
};
|
||||
|
||||
export const GeneratedAPIInstance = <T>(
|
||||
config: AxiosRequestConfig,
|
||||
): Promise<T> => {
|
||||
@@ -29,5 +60,59 @@ generatedAPIAxiosInstance.interceptors.response.use(
|
||||
interceptorRejected,
|
||||
);
|
||||
|
||||
const getDefaultQueryKeyHeaders = (): Record<string, unknown> => {
|
||||
const defaults = generatedAPIAxiosInstance.defaults
|
||||
.headers as unknown as Record<string, unknown>;
|
||||
const headers: Record<string, unknown> = {};
|
||||
const methodKeys = new Set([
|
||||
'common',
|
||||
'delete',
|
||||
'get',
|
||||
'head',
|
||||
'options',
|
||||
'patch',
|
||||
'post',
|
||||
'put',
|
||||
]);
|
||||
|
||||
mergeHeaderRecord(headers, defaults?.common);
|
||||
mergeHeaderRecord(headers, defaults?.get);
|
||||
|
||||
for (const [key, value] of Object.entries(defaults ?? {})) {
|
||||
if (!methodKeys.has(key)) {
|
||||
headers[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return headers;
|
||||
};
|
||||
|
||||
export const getGeneratedAPIQueryKeyHeaders = <THeaders extends object>(
|
||||
headers?: THeaders,
|
||||
): [{ headers: Record<string, unknown> }] | [] => {
|
||||
const mergedHeaders = {
|
||||
...getDefaultQueryKeyHeaders(),
|
||||
...generatedAPIQueryKeyHeaderContext,
|
||||
...(headers as Record<string, unknown> | undefined),
|
||||
};
|
||||
|
||||
const queryKeyHeaders = Object.fromEntries(
|
||||
Object.entries(mergedHeaders)
|
||||
.filter(([, value]) => value !== undefined)
|
||||
.sort(([left], [right]) => left.localeCompare(right))
|
||||
.map(([key, value]) => {
|
||||
if (key.toLowerCase() === 'authorization' && typeof value === 'string') {
|
||||
return [key, hashHeaderValue(value)];
|
||||
}
|
||||
|
||||
return [key, value];
|
||||
}),
|
||||
);
|
||||
|
||||
return Object.keys(queryKeyHeaders).length
|
||||
? [{ headers: queryKeyHeaders }]
|
||||
: [];
|
||||
};
|
||||
|
||||
export type ErrorType<Error> = AxiosError<Error>;
|
||||
export type BodyType<BodyData> = BodyData;
|
||||
|
||||
50
frontend/src/api/queryBuilder/getAggregateAttribute.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { ApiV3Instance } from 'api';
|
||||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { baseAutoCompleteIdKeysOrder } from 'constants/queryBuilder';
|
||||
import { createIdFromObjectFields } from 'lib/createIdFromObjectFields';
|
||||
import createQueryParams from 'lib/createQueryParams';
|
||||
// ** Helpers
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
// ** Types
|
||||
import { IGetAggregateAttributePayload } from 'types/api/queryBuilder/getAggregatorAttribute';
|
||||
import {
|
||||
BaseAutocompleteData,
|
||||
IQueryAutocompleteResponse,
|
||||
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
|
||||
export const getAggregateAttribute = async ({
|
||||
aggregateOperator,
|
||||
searchText,
|
||||
dataSource,
|
||||
source,
|
||||
}: IGetAggregateAttributePayload): Promise<
|
||||
SuccessResponse<IQueryAutocompleteResponse> | ErrorResponse
|
||||
> => {
|
||||
try {
|
||||
const response: AxiosResponse<{
|
||||
data: IQueryAutocompleteResponse;
|
||||
}> = await ApiV3Instance.get(
|
||||
`/autocomplete/aggregate_attributes?${createQueryParams({
|
||||
aggregateOperator,
|
||||
searchText,
|
||||
dataSource: source === 'meter' ? 'meter' : dataSource,
|
||||
})}`,
|
||||
);
|
||||
|
||||
const payload: BaseAutocompleteData[] =
|
||||
response.data.data.attributeKeys?.map(({ id: _, ...item }) => ({
|
||||
...item,
|
||||
id: createIdFromObjectFields(item, baseAutoCompleteIdKeysOrder),
|
||||
})) || [];
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: response.statusText,
|
||||
payload: { attributeKeys: payload },
|
||||
};
|
||||
} catch (e) {
|
||||
return ErrorResponseHandler(e as AxiosError);
|
||||
}
|
||||
};
|
||||
50
frontend/src/api/queryBuilder/getAttributeKeys.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { ApiV3Instance } from 'api';
|
||||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { baseAutoCompleteIdKeysOrder } from 'constants/queryBuilder';
|
||||
import { createIdFromObjectFields } from 'lib/createIdFromObjectFields';
|
||||
import createQueryParams from 'lib/createQueryParams';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import { IGetAttributeKeysPayload } from 'types/api/queryBuilder/getAttributeKeys';
|
||||
import {
|
||||
BaseAutocompleteData,
|
||||
IQueryAutocompleteResponse,
|
||||
} from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
|
||||
export const getAggregateKeys = async ({
|
||||
aggregateOperator,
|
||||
searchText,
|
||||
dataSource,
|
||||
aggregateAttribute,
|
||||
tagType,
|
||||
}: IGetAttributeKeysPayload): Promise<
|
||||
SuccessResponse<IQueryAutocompleteResponse> | ErrorResponse
|
||||
> => {
|
||||
try {
|
||||
const response: AxiosResponse<{
|
||||
data: IQueryAutocompleteResponse;
|
||||
}> = await ApiV3Instance.get(
|
||||
`/autocomplete/attribute_keys?${createQueryParams({
|
||||
aggregateOperator,
|
||||
searchText,
|
||||
dataSource,
|
||||
aggregateAttribute,
|
||||
})}&tagType=${tagType}`,
|
||||
);
|
||||
|
||||
const payload: BaseAutocompleteData[] =
|
||||
response.data.data.attributeKeys?.map(({ id: _, ...item }) => ({
|
||||
...item,
|
||||
id: createIdFromObjectFields(item, baseAutoCompleteIdKeysOrder),
|
||||
})) || [];
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: response.statusText,
|
||||
payload: { attributeKeys: payload },
|
||||
};
|
||||
} catch (e) {
|
||||
return ErrorResponseHandler(e as AxiosError);
|
||||
}
|
||||
};
|
||||
63
frontend/src/api/queryBuilder/getAttributeSuggestions.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { ApiV3Instance } from 'api';
|
||||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { baseAutoCompleteIdKeysOrder } from 'constants/queryBuilder';
|
||||
import { encode } from 'js-base64';
|
||||
import { createIdFromObjectFields } from 'lib/createIdFromObjectFields';
|
||||
import createQueryParams from 'lib/createQueryParams';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import {
|
||||
IGetAttributeSuggestionsPayload,
|
||||
IGetAttributeSuggestionsSuccessResponse,
|
||||
} from 'types/api/queryBuilder/getAttributeSuggestions';
|
||||
import { BaseAutocompleteData } from 'types/api/queryBuilder/queryAutocompleteResponse';
|
||||
|
||||
export const getAttributeSuggestions = async ({
|
||||
searchText,
|
||||
dataSource,
|
||||
filters,
|
||||
}: IGetAttributeSuggestionsPayload): Promise<
|
||||
SuccessResponse<IGetAttributeSuggestionsSuccessResponse> | ErrorResponse
|
||||
> => {
|
||||
try {
|
||||
let base64EncodedFiltersString;
|
||||
try {
|
||||
// the replace function is to remove the padding at the end of base64 encoded string which is auto added to make it a multiple of 4
|
||||
// why ? because the current working of qs doesn't work well with padding
|
||||
base64EncodedFiltersString = encode(JSON.stringify(filters)).replace(
|
||||
/=+$/,
|
||||
'',
|
||||
);
|
||||
} catch {
|
||||
// default base64 encoded string for empty filters object
|
||||
base64EncodedFiltersString = 'eyJpdGVtcyI6W10sIm9wIjoiQU5EIn0';
|
||||
}
|
||||
const response: AxiosResponse<{
|
||||
data: IGetAttributeSuggestionsSuccessResponse;
|
||||
}> = await ApiV3Instance.get(
|
||||
`/filter_suggestions?${createQueryParams({
|
||||
searchText,
|
||||
dataSource,
|
||||
existingFilter: base64EncodedFiltersString,
|
||||
})}`,
|
||||
);
|
||||
|
||||
const payload: BaseAutocompleteData[] =
|
||||
response.data.data.attributes?.map(({ id: _, ...item }) => ({
|
||||
...item,
|
||||
id: createIdFromObjectFields(item, baseAutoCompleteIdKeysOrder),
|
||||
})) || [];
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: response.statusText,
|
||||
payload: {
|
||||
attributes: payload,
|
||||
example_queries: response.data.data.example_queries,
|
||||
},
|
||||
};
|
||||
} catch (e) {
|
||||
return ErrorResponseHandler(e as AxiosError);
|
||||
}
|
||||
};
|
||||
42
frontend/src/api/queryBuilder/getAttributesValues.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { ApiV3Instance } from 'api';
|
||||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||||
import { AxiosError } from 'axios';
|
||||
import createQueryParams from 'lib/createQueryParams';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import {
|
||||
IAttributeValuesResponse,
|
||||
IGetAttributeValuesPayload,
|
||||
} from 'types/api/queryBuilder/getAttributesValues';
|
||||
|
||||
export const getAttributesValues = async ({
|
||||
aggregateOperator,
|
||||
dataSource,
|
||||
aggregateAttribute,
|
||||
attributeKey,
|
||||
filterAttributeKeyDataType,
|
||||
tagType,
|
||||
searchText,
|
||||
}: IGetAttributeValuesPayload): Promise<
|
||||
SuccessResponse<IAttributeValuesResponse> | ErrorResponse
|
||||
> => {
|
||||
try {
|
||||
const response = await ApiV3Instance.get(
|
||||
`/autocomplete/attribute_values?${createQueryParams({
|
||||
aggregateOperator,
|
||||
dataSource,
|
||||
aggregateAttribute,
|
||||
attributeKey,
|
||||
searchText,
|
||||
})}&filterAttributeKeyDataType=${filterAttributeKeyDataType}&tagType=${tagType}`,
|
||||
);
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: response.data.status,
|
||||
payload: response.data.data,
|
||||
};
|
||||
} catch (error) {
|
||||
return ErrorResponseHandler(error as AxiosError);
|
||||
}
|
||||
};
|
||||
27
frontend/src/api/trace/getTraceFlamegraph.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { ApiV2Instance as axios } from 'api';
|
||||
import { omit } from 'lodash-es';
|
||||
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||||
import {
|
||||
GetTraceFlamegraphPayloadProps,
|
||||
GetTraceFlamegraphSuccessResponse,
|
||||
} from 'types/api/trace/getTraceFlamegraph';
|
||||
|
||||
const getTraceFlamegraph = async (
|
||||
props: GetTraceFlamegraphPayloadProps,
|
||||
): Promise<
|
||||
SuccessResponse<GetTraceFlamegraphSuccessResponse> | ErrorResponse
|
||||
> => {
|
||||
const response = await axios.post<GetTraceFlamegraphSuccessResponse>(
|
||||
`/traces/flamegraph/${props.traceId}`,
|
||||
omit(props, 'traceId'),
|
||||
);
|
||||
|
||||
return {
|
||||
statusCode: 200,
|
||||
error: null,
|
||||
message: 'Success',
|
||||
payload: response.data,
|
||||
};
|
||||
};
|
||||
|
||||
export default getTraceFlamegraph;
|
||||
@@ -150,6 +150,15 @@ export const validateFunnelSteps = async (
|
||||
};
|
||||
};
|
||||
|
||||
export interface UpdateFunnelStepDetailsPayload {
|
||||
funnel_id: string;
|
||||
steps: Array<{
|
||||
step_name: string;
|
||||
description: string;
|
||||
}>;
|
||||
updated_at: number;
|
||||
}
|
||||
|
||||
interface UpdateFunnelDescriptionPayload {
|
||||
funnel_id: string;
|
||||
description: string;
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
// V5 Query Range Constants
|
||||
|
||||
import { RequestType } from 'types/api/v5/queryRange';
|
||||
import { ENTITY_VERSION_V5 } from 'constants/app';
|
||||
import {
|
||||
FunctionName,
|
||||
RequestType,
|
||||
SignalType,
|
||||
Step,
|
||||
} from 'types/api/v5/queryRange';
|
||||
|
||||
// ===================== Schema and Version Constants =====================
|
||||
|
||||
export const SCHEMA_VERSION_V5 = ENTITY_VERSION_V5;
|
||||
export const API_VERSION_V5 = 'v5';
|
||||
|
||||
// ===================== Default Values =====================
|
||||
|
||||
export const DEFAULT_STEP_INTERVAL: Step = '60s';
|
||||
export const DEFAULT_LIMIT = 100;
|
||||
export const DEFAULT_OFFSET = 0;
|
||||
|
||||
// ===================== Request Type Constants =====================
|
||||
|
||||
@@ -10,3 +27,142 @@ export const REQUEST_TYPES: Record<string, RequestType> = {
|
||||
RAW: 'raw',
|
||||
DISTRIBUTION: 'distribution',
|
||||
} as const;
|
||||
|
||||
// ===================== Signal Type Constants =====================
|
||||
|
||||
export const SIGNAL_TYPES: Record<string, SignalType> = {
|
||||
TRACES: 'traces',
|
||||
LOGS: 'logs',
|
||||
METRICS: 'metrics',
|
||||
} as const;
|
||||
|
||||
// ===================== Common Aggregation Expressions =====================
|
||||
|
||||
export const TRACE_AGGREGATIONS = {
|
||||
COUNT: 'count()',
|
||||
COUNT_DISTINCT_TRACE_ID: 'count_distinct(traceID)',
|
||||
AVG_DURATION: 'avg(duration_nano)',
|
||||
P50_DURATION: 'p50(duration_nano)',
|
||||
P95_DURATION: 'p95(duration_nano)',
|
||||
P99_DURATION: 'p99(duration_nano)',
|
||||
MAX_DURATION: 'max(duration_nano)',
|
||||
MIN_DURATION: 'min(duration_nano)',
|
||||
SUM_DURATION: 'sum(duration_nano)',
|
||||
} as const;
|
||||
|
||||
export const LOG_AGGREGATIONS = {
|
||||
COUNT: 'count()',
|
||||
COUNT_DISTINCT_HOST: 'count_distinct(host.name)',
|
||||
COUNT_DISTINCT_SERVICE: 'count_distinct(service.name)',
|
||||
COUNT_DISTINCT_CONTAINER: 'count_distinct(container.name)',
|
||||
} as const;
|
||||
|
||||
// ===================== Common Filter Expressions =====================
|
||||
|
||||
export const COMMON_FILTERS = {
|
||||
// Trace filters
|
||||
SERVER_SPANS: "kind_string = 'Server'",
|
||||
CLIENT_SPANS: "kind_string = 'Client'",
|
||||
INTERNAL_SPANS: "kind_string = 'Internal'",
|
||||
ERROR_SPANS: 'http.status_code >= 400',
|
||||
SUCCESS_SPANS: 'http.status_code < 400',
|
||||
|
||||
// Common service filters
|
||||
EXCLUDE_HEALTH_CHECKS: "http.route != '/health' AND http.route != '/ping'",
|
||||
HTTP_REQUESTS: "http.method != ''",
|
||||
|
||||
// Log filters
|
||||
ERROR_LOGS: "severity_text = 'ERROR'",
|
||||
WARN_LOGS: "severity_text = 'WARN'",
|
||||
INFO_LOGS: "severity_text = 'INFO'",
|
||||
DEBUG_LOGS: "severity_text = 'DEBUG'",
|
||||
} as const;
|
||||
|
||||
// ===================== Common Group By Fields =====================
|
||||
|
||||
export const COMMON_GROUP_BY_FIELDS = {
|
||||
SERVICE_NAME: {
|
||||
name: 'service.name',
|
||||
fieldDataType: 'string' as const,
|
||||
fieldContext: 'resource' as const,
|
||||
},
|
||||
HTTP_METHOD: {
|
||||
name: 'http.method',
|
||||
fieldDataType: 'string' as const,
|
||||
fieldContext: 'attribute' as const,
|
||||
},
|
||||
HTTP_ROUTE: {
|
||||
name: 'http.route',
|
||||
fieldDataType: 'string' as const,
|
||||
fieldContext: 'attribute' as const,
|
||||
},
|
||||
HTTP_STATUS_CODE: {
|
||||
name: 'http.status_code',
|
||||
fieldDataType: 'int64' as const,
|
||||
fieldContext: 'attribute' as const,
|
||||
},
|
||||
HOST_NAME: {
|
||||
name: 'host.name',
|
||||
fieldDataType: 'string' as const,
|
||||
fieldContext: 'resource' as const,
|
||||
},
|
||||
CONTAINER_NAME: {
|
||||
name: 'container.name',
|
||||
fieldDataType: 'string' as const,
|
||||
fieldContext: 'resource' as const,
|
||||
},
|
||||
} as const;
|
||||
|
||||
// ===================== Function Names =====================
|
||||
|
||||
export const FUNCTION_NAMES: Record<string, FunctionName> = {
|
||||
CUT_OFF_MIN: 'cutOffMin',
|
||||
CUT_OFF_MAX: 'cutOffMax',
|
||||
CLAMP_MIN: 'clampMin',
|
||||
CLAMP_MAX: 'clampMax',
|
||||
ABSOLUTE: 'absolute',
|
||||
RUNNING_DIFF: 'runningDiff',
|
||||
LOG2: 'log2',
|
||||
LOG10: 'log10',
|
||||
CUM_SUM: 'cumulativeSum',
|
||||
EWMA3: 'ewma3',
|
||||
EWMA5: 'ewma5',
|
||||
EWMA7: 'ewma7',
|
||||
MEDIAN3: 'median3',
|
||||
MEDIAN5: 'median5',
|
||||
MEDIAN7: 'median7',
|
||||
TIME_SHIFT: 'timeShift',
|
||||
ANOMALY: 'anomaly',
|
||||
} as const;
|
||||
|
||||
// ===================== Common Step Intervals =====================
|
||||
|
||||
export const STEP_INTERVALS = {
|
||||
FIFTEEN_SECONDS: '15s',
|
||||
THIRTY_SECONDS: '30s',
|
||||
ONE_MINUTE: '60s',
|
||||
FIVE_MINUTES: '300s',
|
||||
TEN_MINUTES: '600s',
|
||||
FIFTEEN_MINUTES: '900s',
|
||||
THIRTY_MINUTES: '1800s',
|
||||
ONE_HOUR: '3600s',
|
||||
TWO_HOURS: '7200s',
|
||||
SIX_HOURS: '21600s',
|
||||
TWELVE_HOURS: '43200s',
|
||||
ONE_DAY: '86400s',
|
||||
} as const;
|
||||
|
||||
// ===================== Time Range Presets =====================
|
||||
|
||||
export const TIME_RANGE_PRESETS = {
|
||||
LAST_5_MINUTES: 5 * 60 * 1000,
|
||||
LAST_15_MINUTES: 15 * 60 * 1000,
|
||||
LAST_30_MINUTES: 30 * 60 * 1000,
|
||||
LAST_HOUR: 60 * 60 * 1000,
|
||||
LAST_3_HOURS: 3 * 60 * 60 * 1000,
|
||||
LAST_6_HOURS: 6 * 60 * 60 * 1000,
|
||||
LAST_12_HOURS: 12 * 60 * 60 * 1000,
|
||||
LAST_24_HOURS: 24 * 60 * 60 * 1000,
|
||||
LAST_3_DAYS: 3 * 24 * 60 * 60 * 1000,
|
||||
LAST_7_DAYS: 7 * 24 * 60 * 60 * 1000,
|
||||
} as const;
|
||||
|
||||
@@ -21,7 +21,6 @@ import { DataSource, ReduceOperators } from 'types/common/queryBuilder';
|
||||
|
||||
import {
|
||||
convertBuilderQueriesToV5,
|
||||
createAggregation,
|
||||
mapPanelTypeToRequestType,
|
||||
prepareQueryRangePayloadV5,
|
||||
} from './prepareQueryRangePayloadV5';
|
||||
@@ -1016,47 +1015,3 @@ describe('convertBuilderQueriesToV5 builder query type', () => {
|
||||
expect(buildEnvelope(builderQueryType, 'trace').type).toBe('builder_query');
|
||||
});
|
||||
});
|
||||
|
||||
describe('createAggregation fallback', () => {
|
||||
const logsQuery = (expression: string): Partial<IBuilderQuery> => ({
|
||||
dataSource: DataSource.LOGS,
|
||||
aggregations: [{ expression }],
|
||||
});
|
||||
|
||||
it('sends no aggregation for a heatmap with no field', () => {
|
||||
expect(createAggregation(logsQuery(''), PANEL_TYPES.HEATMAP)).toStrictEqual(
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
it('reads a field on a heatmap and turns it into count() elsewhere', () => {
|
||||
expect(
|
||||
createAggregation(logsQuery('duration_nano'), PANEL_TYPES.HEATMAP),
|
||||
).toStrictEqual([{ expression: 'duration_nano' }]);
|
||||
expect(
|
||||
createAggregation(logsQuery('duration_nano'), PANEL_TYPES.TIME_SERIES),
|
||||
).toStrictEqual([{ expression: 'count()' }]);
|
||||
});
|
||||
|
||||
it('still defaults other panels to count()', () => {
|
||||
expect(
|
||||
createAggregation(logsQuery(''), PANEL_TYPES.TIME_SERIES),
|
||||
).toStrictEqual([{ expression: 'count()' }]);
|
||||
});
|
||||
|
||||
it('sends the field of a logs heatmap query', () => {
|
||||
const [envelope] = convertBuilderQueriesToV5(
|
||||
{
|
||||
A: {
|
||||
...logsQuery('duration_nano'),
|
||||
queryName: 'A',
|
||||
} as IBuilderQuery,
|
||||
},
|
||||
mapPanelTypeToRequestType(PANEL_TYPES.HEATMAP),
|
||||
PANEL_TYPES.HEATMAP,
|
||||
);
|
||||
expect((envelope.spec as LogBuilderQuery).aggregations).toStrictEqual([
|
||||
{ expression: 'duration_nano' },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,8 +5,6 @@ import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||
import { GetQueryResultsProps } from 'lib/dashboard/getQueryResults';
|
||||
import { foldAISlot } from 'lib/query/builderSlot';
|
||||
import getStartEndRangeTime from 'lib/getStartEndRangeTime';
|
||||
import { parseAggregations } from 'lib/query/aggregationExpression';
|
||||
import { aggregatesDistributionField } from 'lib/query/distributionField';
|
||||
import { mapQueryDataToApi } from 'lib/newQueryBuilder/queryBuilderMappers/mapQueryDataToApi';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import { DynamicVariableSuggestion } from 'providers/Dashboard/store/dynamicVariableSuggestions';
|
||||
@@ -242,6 +240,32 @@ function createBaseSpec(
|
||||
};
|
||||
}
|
||||
|
||||
// Utility to parse aggregation expressions with optional alias
|
||||
export function parseAggregations(
|
||||
expression: string,
|
||||
availableAlias?: string,
|
||||
): { expression: string; alias?: string }[] {
|
||||
const result: { expression: string; alias?: string }[] = [];
|
||||
// Matches function calls like "count()" or "sum(field)" with optional alias like "as 'alias'"
|
||||
// Handles quoted ('alias'), dash-separated (field-name), and unquoted values after "as" keyword
|
||||
const regex =
|
||||
/([a-zA-Z0-9_]+\([^)]*\))(?:\s*as\s+((?:'[^']*'|"[^"]*"|[a-zA-Z0-9_-]+)))?/g;
|
||||
let match = regex.exec(expression);
|
||||
while (match !== null) {
|
||||
const expr = match[1];
|
||||
let alias = match[2] || availableAlias; // Use provided alias or availableAlias if not matched
|
||||
if (alias) {
|
||||
// Remove quotes if present
|
||||
alias = alias.replace(/^['"]|['"]$/g, '');
|
||||
result.push({ expression: expr, alias });
|
||||
} else {
|
||||
result.push({ expression: expr });
|
||||
}
|
||||
match = regex.exec(expression);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function createAggregation(
|
||||
queryData: any,
|
||||
panelType?: PANEL_TYPES,
|
||||
@@ -286,28 +310,18 @@ export function createAggregation(
|
||||
];
|
||||
}
|
||||
|
||||
// A heatmap buckets the field the user names; count() would be rejected as one.
|
||||
// Elsewhere a field is not an aggregation, so it falls back to count().
|
||||
const isDistributionField = aggregatesDistributionField(
|
||||
panelType,
|
||||
queryData.dataSource,
|
||||
);
|
||||
const fallback = isDistributionField ? [] : [{ expression: 'count()' }];
|
||||
|
||||
if (queryData.aggregations?.length > 0) {
|
||||
return queryData.aggregations.flatMap(
|
||||
(agg: { expression: string; alias?: string }) => {
|
||||
const parsedAggregations = parseAggregations(
|
||||
agg.expression,
|
||||
agg?.alias,
|
||||
isDistributionField,
|
||||
);
|
||||
return isEmpty(parsedAggregations) ? fallback : parsedAggregations;
|
||||
const parsedAggregations = parseAggregations(agg.expression, agg?.alias);
|
||||
return isEmpty(parsedAggregations)
|
||||
? [{ expression: 'count()' }]
|
||||
: parsedAggregations;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return fallback;
|
||||
return [{ expression: 'count()' }];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
39
frontend/src/assets/AlertHistory/SeverityCriticalIcon.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
interface SeverityCriticalIconProps {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
}
|
||||
|
||||
function SeverityCriticalIcon({
|
||||
width,
|
||||
height,
|
||||
fill,
|
||||
stroke,
|
||||
}: SeverityCriticalIconProps): JSX.Element {
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
fill={fill}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M.99707.666056.99707 2.99939M.99707 5.33337H.991237M3.00293.666056 3.00293 2.99939M3.00293 5.33337H2.9971M5.00879.666056V2.99939M5.00879 5.33337H5.00296"
|
||||
stroke={stroke}
|
||||
strokeWidth="1.16667"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
SeverityCriticalIcon.defaultProps = {
|
||||
width: 6,
|
||||
height: 6,
|
||||
fill: 'none',
|
||||
stroke: '#F56C87',
|
||||
};
|
||||
|
||||
export default SeverityCriticalIcon;
|
||||
42
frontend/src/assets/AlertHistory/SeverityErrorIcon.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
interface SeverityErrorIconProps {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: string;
|
||||
}
|
||||
|
||||
function SeverityErrorIcon({
|
||||
width,
|
||||
height,
|
||||
fill,
|
||||
stroke,
|
||||
strokeWidth,
|
||||
}: SeverityErrorIconProps): JSX.Element {
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
fill={fill}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1.00781.957845 1.00781 2.99951M1.00781 5.04175H1.00228"
|
||||
stroke={stroke}
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
SeverityErrorIcon.defaultProps = {
|
||||
width: 2,
|
||||
height: 6,
|
||||
fill: 'none',
|
||||
stroke: '#F56C87',
|
||||
strokeWidth: '1.02083',
|
||||
};
|
||||
|
||||
export default SeverityErrorIcon;
|
||||
46
frontend/src/assets/AlertHistory/SeverityInfoIcon.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
interface SeverityInfoIconProps {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
}
|
||||
|
||||
function SeverityInfoIcon({
|
||||
width,
|
||||
height,
|
||||
fill,
|
||||
stroke,
|
||||
}: SeverityInfoIconProps): JSX.Element {
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
fill={fill}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<rect
|
||||
width={width}
|
||||
height={height}
|
||||
rx="3.5"
|
||||
fill={stroke}
|
||||
fillOpacity=".2"
|
||||
/>
|
||||
<path
|
||||
d="M7 9.33346V7.00012M7 4.66675H7.00583"
|
||||
stroke={stroke}
|
||||
strokeWidth="1.16667"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
SeverityInfoIcon.defaultProps = {
|
||||
width: 14,
|
||||
height: 14,
|
||||
fill: 'none',
|
||||
stroke: '#7190F9',
|
||||
};
|
||||
|
||||
export default SeverityInfoIcon;
|
||||
42
frontend/src/assets/AlertHistory/SeverityWarningIcon.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
interface SeverityWarningIconProps {
|
||||
width?: number;
|
||||
height?: number;
|
||||
fill?: string;
|
||||
stroke?: string;
|
||||
strokeWidth?: string;
|
||||
}
|
||||
|
||||
function SeverityWarningIcon({
|
||||
width,
|
||||
height,
|
||||
fill,
|
||||
stroke,
|
||||
strokeWidth,
|
||||
}: SeverityWarningIconProps): JSX.Element {
|
||||
return (
|
||||
<svg
|
||||
width={width}
|
||||
height={height}
|
||||
fill={fill}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M1.00732.957845 1.00732 2.99951M1.00732 5.04175H1.00179"
|
||||
stroke={stroke}
|
||||
strokeWidth={strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
SeverityWarningIcon.defaultProps = {
|
||||
width: 2,
|
||||
height: 6,
|
||||
fill: 'none',
|
||||
stroke: '#FFD778',
|
||||
strokeWidth: '0.978299',
|
||||
};
|
||||
|
||||
export default SeverityWarningIcon;
|
||||
17
frontend/src/assets/Images/activeDot.svg
Normal file
@@ -0,0 +1,17 @@
|
||||
<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_d_2445_31698)">
|
||||
<circle cx="23" cy="23" r="3" fill="#51E7A8"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d_2445_31698" x="0" y="0" width="46" height="46" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset/>
|
||||
<feGaussianBlur stdDeviation="10"/>
|
||||
<feComposite in2="hardAlpha" operator="out"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0.317647 0 0 0 0 0.905882 0 0 0 0 0.658824 0 0 0 0.6 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2445_31698"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2445_31698" result="shape"/>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 910 B |
234
frontend/src/assets/Images/blankDashboardTemplatePreview.svg
Normal file
|
After Width: | Height: | Size: 204 KiB |
458
frontend/src/assets/Images/dotted-divider.svg
Normal file
@@ -0,0 +1,458 @@
|
||||
<svg
|
||||
width="1348"
|
||||
height="8"
|
||||
viewBox="0 0 1348 8"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<rect width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="12" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="18" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="24" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="30" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="36" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="42" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="48" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="54" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="60" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="66" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="72" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="78" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="84" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="90" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="96" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="102" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="108" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="114" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="120" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="126" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="132" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="138" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="144" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="150" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="156" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="162" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="168" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="174" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="180" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="186" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="192" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="198" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="204" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="210" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="216" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="222" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="228" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="234" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="240" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="246" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="252" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="258" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="264" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="270" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="276" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="282" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="288" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="294" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="300" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="306" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="312" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="318" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="324" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="330" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="336" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="342" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="348" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="354" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="360" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="366" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="372" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="378" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="384" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="390" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="396" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="402" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="408" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="414" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="420" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="426" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="432" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="438" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="444" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="450" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="456" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="462" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="468" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="474" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="480" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="486" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="492" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="498" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="504" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="510" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="516" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="522" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="528" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="534" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="540" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="546" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="552" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="558" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="564" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="570" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="576" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="582" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="588" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="594" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="600" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="606" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="612" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="618" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="624" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="630" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="636" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="642" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="648" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="654" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="660" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="666" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="672" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="678" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="684" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="690" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="696" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="702" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="708" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="714" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="720" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="726" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="732" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="738" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="744" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="750" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="756" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="762" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="768" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="774" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="780" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="786" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="792" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="798" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="804" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="810" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="816" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="822" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="828" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="834" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="840" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="846" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="852" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="858" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="864" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="870" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="876" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="882" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="888" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="894" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="900" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="906" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="912" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="918" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="924" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="930" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="936" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="942" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="948" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="954" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="960" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="966" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="972" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="978" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="984" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="990" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="996" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1002" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1008" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1014" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1020" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1026" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1032" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1038" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1044" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1050" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1056" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1062" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1068" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1074" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1080" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1086" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1092" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1098" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1104" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1110" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1116" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1122" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1128" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1134" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1140" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1146" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1152" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1158" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1164" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1170" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1176" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1182" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1188" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1194" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1200" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1206" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1212" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1218" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1224" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1230" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1236" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1242" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1248" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1254" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1260" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1266" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1272" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1278" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1284" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1290" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1296" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1302" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1308" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1314" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1320" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1326" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1332" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1338" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1344" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="6" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="12" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="18" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="24" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="30" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="36" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="42" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="48" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="54" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="60" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="66" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="72" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="78" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="84" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="90" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="96" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="102" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="108" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="114" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="120" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="126" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="132" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="138" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="144" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="150" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="156" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="162" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="168" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="174" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="180" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="186" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="192" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="198" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="204" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="210" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="216" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="222" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="228" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="234" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="240" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="246" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="252" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="258" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="264" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="270" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="276" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="282" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="288" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="294" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="300" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="306" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="312" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="318" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="324" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="330" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="336" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="342" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="348" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="354" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="360" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="366" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="372" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="378" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="384" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="390" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="396" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="402" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="408" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="414" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="420" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="426" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="432" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="438" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="444" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="450" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="456" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="462" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="468" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="474" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="480" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="486" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="492" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="498" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="504" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="510" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="516" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="522" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="528" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="534" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="540" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="546" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="552" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="558" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="564" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="570" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="576" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="582" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="588" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="594" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="600" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="606" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="612" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="618" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="624" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="630" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="636" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="642" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="648" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="654" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="660" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="666" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="672" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="678" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="684" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="690" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="696" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="702" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="708" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="714" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="720" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="726" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="732" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="738" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="744" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="750" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="756" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="762" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="768" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="774" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="780" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="786" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="792" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="798" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="804" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="810" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="816" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="822" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="828" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="834" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="840" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="846" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="852" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="858" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="864" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="870" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="876" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="882" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="888" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="894" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="900" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="906" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="912" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="918" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="924" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="930" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="936" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="942" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="948" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="954" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="960" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="966" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="972" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="978" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="984" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="990" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="996" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1002" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1008" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1014" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1020" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1026" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1032" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1038" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1044" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1050" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1056" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1062" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1068" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1074" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1080" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1086" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1092" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1098" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1104" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1110" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1116" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1122" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1128" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1134" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1140" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1146" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1152" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1158" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1164" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1170" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1176" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1182" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1188" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1194" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1200" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1206" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1212" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1218" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1224" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1230" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1236" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1242" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1248" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1254" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1260" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1266" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1272" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1278" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1284" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1290" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1296" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1302" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1308" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1314" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1320" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1326" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1332" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1338" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
<rect x="1344" y="6" width="2" height="2" rx="1" fill="#242834" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 31 KiB |
BIN
frontend/src/assets/Images/integrations-hero-bg.png
Normal file
|
After Width: | Height: | Size: 194 KiB |
9
frontend/src/assets/Images/redisTemplatePreview.svg
Normal file
|
After Width: | Height: | Size: 1.7 MiB |
1
frontend/src/assets/SigNoz-dark.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 565.65 130.02"><defs><style>.cls-1{fill:#17181a;}.cls-2{fill:#f15931;}.cls-3{fill:#f9f2f8;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M157.17,97.54q-7.86-7.79-7.85-21.71h17.22q0,6.58,3.35,10.32t9.31,3.73h14.06a15.93,15.93,0,0,0,9.05-2.34,7.22,7.22,0,0,0,3.48-6.27V77q0-6.21-9.12-7.73l-23.29-3.92Q162,63.42,156.09,58A17.81,17.81,0,0,1,150.2,44.3V37.21a20.09,20.09,0,0,1,3.61-11.84,23.11,23.11,0,0,1,10.26-7.92,39.67,39.67,0,0,1,15.38-2.78h14.31a30.14,30.14,0,0,1,14.56,3.42,24.37,24.37,0,0,1,9.82,9.56,28.37,28.37,0,0,1,3.48,14.24H204.4a12.27,12.27,0,0,0-2.92-8.55,9.89,9.89,0,0,0-7.72-3.22H179.45a14.51,14.51,0,0,0-8.54,2.28,7.05,7.05,0,0,0-3.23,6.07v3.42q0,6.33,8.73,7.85l23.18,4q11.52,2,17.6,7.16a16.52,16.52,0,0,1,6.07,13.23v8.36a19.86,19.86,0,0,1-3.73,11.9,24.08,24.08,0,0,1-10.45,8,39.54,39.54,0,0,1-15.57,2.85H179Q165,105.33,157.17,97.54Z"/><path class="cls-1" d="M237.89,32.33a9.93,9.93,0,0,1-3-7.53,10,10,0,0,1,3-7.54,12.42,12.42,0,0,1,15.83,0,10,10,0,0,1,3,7.54,10,10,0,0,1-3,7.53,12.42,12.42,0,0,1-15.83,0Zm-.7,8.8h17.22v63.19H237.19Z"/><path class="cls-1" d="M279.1,124.26a21.43,21.43,0,0,1-7.47-15.13h17a6.41,6.41,0,0,0,2.28,4.49,7.58,7.58,0,0,0,5.06,1.71h11.4a7.65,7.65,0,0,0,6.39-3.23,13.46,13.46,0,0,0,2.47-8.42v-6a18.47,18.47,0,0,1-6.14,4.43,16.59,16.59,0,0,1-6.9,1.65h-8.74q-11.52,0-18.55-6.84t-7-18V66.08a27.41,27.41,0,0,1,3.3-13.62,22.83,22.83,0,0,1,9.24-9.11,28.27,28.27,0,0,1,13.68-3.23h7.34a18.87,18.87,0,0,1,8.42,2,18.64,18.64,0,0,1,6.65,5.31V41.13h15.95v62.55a28.43,28.43,0,0,1-3.23,13.81,22.81,22.81,0,0,1-9.18,9.24A27.79,27.79,0,0,1,307.34,130h-11.4Q285.82,130,279.1,124.26Zm25.2-35a10.11,10.11,0,0,0,8.1-4,18.2,18.2,0,0,0,3.8-10.45V66.08A13.26,13.26,0,0,0,312.78,58a9.76,9.76,0,0,0-7.34-3h-8.86a9.5,9.5,0,0,0-7.6,3.42,13.4,13.4,0,0,0-2.91,9V77.73a12.55,12.55,0,0,0,2.65,8.35,8.55,8.55,0,0,0,6.84,3.17Z"/><path class="cls-1" d="M348.62,15.68h15.57L406.73,76V15.68h17.1v88.64H408.26L365.71,44v60.28H348.62Z"/><path class="cls-1" d="M449.34,102.23a22.51,22.51,0,0,1-9.49-8.8,25.45,25.45,0,0,1-3.36-13.17V65.44a25.42,25.42,0,0,1,3.42-13.23,23.29,23.29,0,0,1,9.56-8.93,30.5,30.5,0,0,1,14.12-3.16H475a30.5,30.5,0,0,1,14.12,3.16,23.35,23.35,0,0,1,9.56,8.93,25.42,25.42,0,0,1,3.42,13.23V80.26a25.1,25.1,0,0,1-3.42,13.17,23,23,0,0,1-9.56,8.8,31.14,31.14,0,0,1-14.24,3.1h-11.4A30.86,30.86,0,0,1,449.34,102.23ZM474.6,90.52a9.37,9.37,0,0,0,7.47-3.23,12.43,12.43,0,0,0,2.79-8.42V66.58a12.43,12.43,0,0,0-2.79-8.42,9.21,9.21,0,0,0-7.34-3.23H463.84a9.21,9.21,0,0,0-7.34,3.23,12.43,12.43,0,0,0-2.79,8.42V78.87a12.43,12.43,0,0,0,2.79,8.42,9.08,9.08,0,0,0,7.21,3.23Z"/><path class="cls-1" d="M506.89,95.71l34.19-40H508.41V41.13h57.24v8.61l-34.19,40H565v14.56H506.89Z"/><path class="cls-2" d="M61.1,119.86C27.16,119.86,0,93.22,0,59.93,0,27,27.16,0,61.1,0H99.46a22.17,22.17,0,0,1,22.4,22v38C121.86,93.22,94.71,119.86,61.1,119.86Z"/><path class="cls-3" d="M60.62,34C35.27,34,21,55,20.39,55.87a6.53,6.53,0,0,0,0,7.26C21,64,35.27,85,60.62,85s39.64-21,40.23-21.89a6.51,6.51,0,0,0,0-7.25C100.26,55,86,34,60.62,34ZM23.9,60.79a2.33,2.33,0,0,1,0-2.58c.48-.72,10.65-15.65,28.83-19.24a22,22,0,0,0,0,41.05C34.55,76.44,24.38,61.5,23.9,60.79ZM50.49,59.5a2.11,2.11,0,0,1-4.22,0A14.36,14.36,0,0,1,60.62,45.15a2.11,2.11,0,1,1,0,4.21A10.14,10.14,0,0,0,50.49,59.5Zm10.13,5.13a5.13,5.13,0,1,1,5.13-5.13A5.13,5.13,0,0,1,60.62,64.63Zm36.72-3.84C96.86,61.5,86.7,76.44,68.52,80a22,22,0,0,0,0-41C86.7,42.56,96.86,57.49,97.34,58.21A2.29,2.29,0,0,1,97.34,60.79Z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
1
frontend/src/assets/SigNoz-white.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 565.65 130.02"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#f15931;}.cls-3{fill:#f9f2f8;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M157.17,97.54q-7.86-7.79-7.85-21.71h17.22q0,6.58,3.35,10.32t9.31,3.73h14.06a15.93,15.93,0,0,0,9.05-2.34,7.22,7.22,0,0,0,3.48-6.27V77q0-6.21-9.12-7.73l-23.29-3.92Q162,63.42,156.09,58A17.81,17.81,0,0,1,150.2,44.3V37.21a20.09,20.09,0,0,1,3.61-11.84,23.11,23.11,0,0,1,10.26-7.92,39.67,39.67,0,0,1,15.38-2.78h14.31a30.14,30.14,0,0,1,14.56,3.42,24.37,24.37,0,0,1,9.82,9.56,28.37,28.37,0,0,1,3.48,14.24H204.4a12.27,12.27,0,0,0-2.92-8.55,9.89,9.89,0,0,0-7.72-3.22H179.45a14.51,14.51,0,0,0-8.54,2.28,7.05,7.05,0,0,0-3.23,6.07v3.42q0,6.33,8.73,7.85l23.18,4q11.52,2,17.6,7.16a16.52,16.52,0,0,1,6.07,13.23v8.36a19.86,19.86,0,0,1-3.73,11.9,24.08,24.08,0,0,1-10.45,8,39.54,39.54,0,0,1-15.57,2.85H179Q165,105.33,157.17,97.54Z"/><path class="cls-1" d="M237.89,32.33a9.93,9.93,0,0,1-3-7.53,10,10,0,0,1,3-7.54,12.42,12.42,0,0,1,15.83,0,10,10,0,0,1,3,7.54,10,10,0,0,1-3,7.53,12.42,12.42,0,0,1-15.83,0Zm-.7,8.8h17.22v63.19H237.19Z"/><path class="cls-1" d="M279.1,124.26a21.43,21.43,0,0,1-7.47-15.13h17a6.41,6.41,0,0,0,2.28,4.49,7.58,7.58,0,0,0,5.06,1.71h11.4a7.65,7.65,0,0,0,6.39-3.23,13.46,13.46,0,0,0,2.47-8.42v-6a18.47,18.47,0,0,1-6.14,4.43,16.59,16.59,0,0,1-6.9,1.65h-8.74q-11.52,0-18.55-6.84t-7-18V66.08a27.41,27.41,0,0,1,3.3-13.62,22.83,22.83,0,0,1,9.24-9.11,28.27,28.27,0,0,1,13.68-3.23h7.34a18.87,18.87,0,0,1,8.42,2,18.64,18.64,0,0,1,6.65,5.31V41.13h15.95v62.55a28.43,28.43,0,0,1-3.23,13.81,22.81,22.81,0,0,1-9.18,9.24A27.79,27.79,0,0,1,307.34,130h-11.4Q285.82,130,279.1,124.26Zm25.2-35a10.11,10.11,0,0,0,8.1-4,18.2,18.2,0,0,0,3.8-10.45V66.08A13.26,13.26,0,0,0,312.78,58a9.76,9.76,0,0,0-7.34-3h-8.86a9.5,9.5,0,0,0-7.6,3.42,13.4,13.4,0,0,0-2.91,9V77.73a12.55,12.55,0,0,0,2.65,8.35,8.55,8.55,0,0,0,6.84,3.17Z"/><path class="cls-1" d="M348.62,15.68h15.57L406.73,76V15.68h17.1v88.64H408.26L365.71,44v60.28H348.62Z"/><path class="cls-1" d="M449.34,102.23a22.51,22.51,0,0,1-9.49-8.8,25.45,25.45,0,0,1-3.36-13.17V65.44a25.42,25.42,0,0,1,3.42-13.23,23.29,23.29,0,0,1,9.56-8.93,30.5,30.5,0,0,1,14.12-3.16H475a30.5,30.5,0,0,1,14.12,3.16,23.35,23.35,0,0,1,9.56,8.93,25.42,25.42,0,0,1,3.42,13.23V80.26a25.1,25.1,0,0,1-3.42,13.17,23,23,0,0,1-9.56,8.8,31.14,31.14,0,0,1-14.24,3.1h-11.4A30.86,30.86,0,0,1,449.34,102.23ZM474.6,90.52a9.37,9.37,0,0,0,7.47-3.23,12.43,12.43,0,0,0,2.79-8.42V66.58a12.43,12.43,0,0,0-2.79-8.42,9.21,9.21,0,0,0-7.34-3.23H463.84a9.21,9.21,0,0,0-7.34,3.23,12.43,12.43,0,0,0-2.79,8.42V78.87a12.43,12.43,0,0,0,2.79,8.42,9.08,9.08,0,0,0,7.21,3.23Z"/><path class="cls-1" d="M506.89,95.71l34.19-40H508.41V41.13h57.24v8.61l-34.19,40H565v14.56H506.89Z"/><path class="cls-2" d="M61.1,119.86C27.16,119.86,0,93.22,0,59.93,0,27,27.16,0,61.1,0H99.46a22.17,22.17,0,0,1,22.4,22v38C121.86,93.22,94.71,119.86,61.1,119.86Z"/><path class="cls-3" d="M60.62,34C35.27,34,21,55,20.39,55.87a6.53,6.53,0,0,0,0,7.26C21,64,35.27,85,60.62,85s39.64-21,40.23-21.89a6.51,6.51,0,0,0,0-7.25C100.26,55,86,34,60.62,34ZM23.9,60.79a2.33,2.33,0,0,1,0-2.58c.48-.72,10.65-15.65,28.83-19.24a22,22,0,0,0,0,41.05C34.55,76.44,24.38,61.5,23.9,60.79ZM50.49,59.5a2.11,2.11,0,0,1-4.22,0A14.36,14.36,0,0,1,60.62,45.15a2.11,2.11,0,1,1,0,4.21A10.14,10.14,0,0,0,50.49,59.5Zm10.13,5.13a5.13,5.13,0,1,1,5.13-5.13A5.13,5.13,0,0,1,60.62,64.63Zm36.72-3.84C96.86,61.5,86.7,76.44,68.52,80a22,22,0,0,0,0-41C86.7,42.56,96.86,57.49,97.34,58.21A2.29,2.29,0,0,1,97.34,60.79Z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
1
frontend/src/auto-import-registry.d.ts
vendored
@@ -12,5 +12,4 @@
|
||||
|
||||
import '@signozhq/design-tokens';
|
||||
import '@signozhq/icons';
|
||||
import '@signozhq/noz-client';
|
||||
import '@signozhq/ui';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { act, render, screen } from 'tests/test-utils';
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
|
||||
import LabelColumn from './LabelColumn';
|
||||
|
||||
@@ -92,9 +92,7 @@ describe('LabelColumn', () => {
|
||||
renderWithProviders(<LabelColumn labels={labels} />);
|
||||
|
||||
const isHidden = (label: string): boolean =>
|
||||
screen
|
||||
.getByTestId(`label-tag-container-${label}`)
|
||||
.classList.contains('overflowed');
|
||||
screen.getByTestId(`label-tag-${label}`).closest('.overflowed') !== null;
|
||||
|
||||
expect(labels.filter(isHidden)).toStrictEqual(['team', 'owner', 'version']);
|
||||
expect(screen.getByTestId('label-overflow-badge')).toHaveTextContent('+3');
|
||||
@@ -159,7 +157,8 @@ describe('LabelColumn', () => {
|
||||
it('should render empty when no labels provided', () => {
|
||||
renderWithProviders(<LabelColumn labels={[]} />);
|
||||
|
||||
expect(screen.getByTestId('label-column')).toBeEmptyDOMElement();
|
||||
const column = screen.getByTestId('label-column');
|
||||
expect(column.children).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should use primary color by default', () => {
|
||||
|
||||
@@ -45,7 +45,7 @@ function LabelTag({
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<span className={className} data-testid={`label-tag-container-${label}`}>
|
||||
<span className={className}>
|
||||
<Badge
|
||||
textTransform="none"
|
||||
color={color ?? 'secondary'}
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
|
||||
.brand-tagline {
|
||||
margin-bottom: 24px;
|
||||
|
||||
.ant-typography {
|
||||
color: var(--l2-foreground); // Secondary text
|
||||
}
|
||||
}
|
||||
|
||||
/* HTML: <div class="loader"></div> */
|
||||
|
||||
@@ -22,10 +22,7 @@ function AppLoading(): JSX.Element {
|
||||
const isDarkMode = getThemeFromStorage();
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`app-loading-container ${isDarkMode ? 'dark' : 'lightMode'}`}
|
||||
data-testid="app-loading-container"
|
||||
>
|
||||
<div className={`app-loading-container ${isDarkMode ? 'dark' : 'lightMode'}`}>
|
||||
<div className="perilin-bg" />
|
||||
<div className="app-loading-content">
|
||||
<div className="brand">
|
||||
@@ -56,7 +53,7 @@ function AppLoading(): JSX.Element {
|
||||
</Typography>
|
||||
</div>
|
||||
|
||||
<div className="loader" data-testid="app-loading-loader" />
|
||||
<div className="loader" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { screen } from 'tests/test-utils';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
|
||||
import getLocal from '../../../api/browser/localstorage/get';
|
||||
import AppLoading from '../AppLoading';
|
||||
@@ -16,6 +15,7 @@ describe('AppLoading', () => {
|
||||
const SIGNOZ_TEXT = 'SigNoz';
|
||||
const TAGLINE_TEXT =
|
||||
'OpenTelemetry-Native Logs, Metrics and Traces in a single pane';
|
||||
const CONTAINER_SELECTOR = '.app-loading-container';
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
@@ -33,7 +33,7 @@ describe('AppLoading', () => {
|
||||
expect(screen.getByText(TAGLINE_TEXT)).toBeInTheDocument();
|
||||
|
||||
// Check if dark theme class is applied
|
||||
const container = screen.getByTestId('app-loading-container');
|
||||
const container = screen.getByText(SIGNOZ_TEXT).closest(CONTAINER_SELECTOR);
|
||||
expect(container).toHaveClass('dark');
|
||||
expect(container).not.toHaveClass('lightMode');
|
||||
});
|
||||
@@ -58,7 +58,7 @@ describe('AppLoading', () => {
|
||||
expect(tagline).toBeInTheDocument();
|
||||
|
||||
// Check for loader
|
||||
const loader = screen.getByTestId('app-loading-loader');
|
||||
const loader = document.querySelector('.loader');
|
||||
expect(loader).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('AppLoading', () => {
|
||||
|
||||
// Should still render with dark theme as fallback
|
||||
expect(screen.getByText(SIGNOZ_TEXT)).toBeInTheDocument();
|
||||
const container = screen.getByTestId('app-loading-container');
|
||||
const container = screen.getByText(SIGNOZ_TEXT).closest(CONTAINER_SELECTOR);
|
||||
expect(container).toHaveClass('dark');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Toaster } from '@signozhq/ui/toast';
|
||||
const PAGE_INSET = { bottom: 'var(--bottom-strip-height, 0px)' };
|
||||
|
||||
function AppToaster(): JSX.Element {
|
||||
return <Toaster position="top-right" pageInset={PAGE_INSET} />;
|
||||
return <Toaster position="bottom-right" pageInset={PAGE_INSET} />;
|
||||
}
|
||||
|
||||
export default AppToaster;
|
||||
|
||||
@@ -57,5 +57,9 @@
|
||||
|
||||
.ant-drawer-footer {
|
||||
border-top: 1px solid var(--l1-border);
|
||||
|
||||
.footer-text {
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,6 +141,10 @@
|
||||
border-radius: 4px;
|
||||
padding: 6px 24px 6px 12px;
|
||||
width: max-content;
|
||||
|
||||
.configure-option-Info-text {
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
}
|
||||
|
||||
.row-panel {
|
||||
@@ -153,6 +157,11 @@
|
||||
height: 48px !important;
|
||||
width: 100%;
|
||||
|
||||
.ant-typography {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.row-panel-section {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
.scrollHint {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.scrollButton {
|
||||
position: absolute;
|
||||
bottom: var(--spacing-7);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
.scrollIcon {
|
||||
animation: pulse 1s infinite;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
.changelog-modal {
|
||||
.ant-modal-content {
|
||||
padding: unset;
|
||||
background-color: var(--l2-background);
|
||||
|
||||
.ant-modal-header {
|
||||
margin-bottom: unset;
|
||||
}
|
||||
|
||||
.ant-modal-footer {
|
||||
margin-top: unset;
|
||||
}
|
||||
}
|
||||
|
||||
&-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background-color: var(--l2-background);
|
||||
padding: 16px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: var(--l1-foreground);
|
||||
border-bottom: 1px solid var(--l1-border);
|
||||
}
|
||||
|
||||
&-footer.scroll-available {
|
||||
.scroll-btn-container {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-footer {
|
||||
position: relative;
|
||||
border: 1px solid var(--l1-border);
|
||||
padding: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
&-label {
|
||||
color: var(--text-robin-400);
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
position: relative;
|
||||
padding-left: 14px;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
transform: translateY(-50%);
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 100%;
|
||||
background-color: var(--primary-background);
|
||||
}
|
||||
}
|
||||
|
||||
&-ctas {
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
|
||||
& svg {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-btn-container {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: -40px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
.scroll-btn {
|
||||
all: unset;
|
||||
padding: 4px 12px 4px 10px;
|
||||
background-color: var(--l1-border);
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
transition: background-color 0.1s;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--l1-border);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: var(--l1-border);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
|
||||
// add animation to the chevrons down icon
|
||||
svg {
|
||||
animation: pulse 1s infinite;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-content {
|
||||
max-height: calc(100vh - 300px);
|
||||
overflow-y: auto;
|
||||
padding: 16px 16px 18px 16px;
|
||||
border: 1px solid var(--l1-border);
|
||||
border-top-width: 0;
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// pulse for the scroll for more icon
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useMutation } from 'react-query';
|
||||
import { Check, ChevronsDown, ScrollText, X } from '@signozhq/icons';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Dialog } from '@signozhq/ui/dialog';
|
||||
import { Button, Modal } from 'antd';
|
||||
import Flex from 'periscope/components/Flex/Flex';
|
||||
import updateUserPreference from 'api/v1/user/preferences/name/update';
|
||||
import cx from 'classnames';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import dayjs from 'dayjs';
|
||||
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
|
||||
@@ -12,9 +13,8 @@ import { ChangelogSchema } from 'types/api/changelog/getChangelogByVersion';
|
||||
import { UserPreference } from 'types/api/preferences/preference';
|
||||
|
||||
import ChangelogRenderer from './components/ChangelogRenderer';
|
||||
import { useChangelogScroll } from './useChangelogScroll';
|
||||
|
||||
import styles from './ChangelogModal.module.scss';
|
||||
import './ChangelogModal.styles.scss';
|
||||
|
||||
interface Props {
|
||||
changelog: ChangelogSchema;
|
||||
@@ -22,7 +22,8 @@ interface Props {
|
||||
}
|
||||
|
||||
function ChangelogModal({ changelog, onClose }: Props): JSX.Element {
|
||||
const { contentRef, hasScroll, scrollForMore } = useChangelogScroll();
|
||||
const [hasScroll, setHasScroll] = useState(false);
|
||||
const changelogContentSectionRef = useRef<HTMLDivElement>(null);
|
||||
const { userPreferences, updateUserPreferenceInContext } = useAppContext();
|
||||
|
||||
const formattedReleaseDate = dayjs(changelog?.release_date).format(
|
||||
@@ -56,6 +57,30 @@ function ChangelogModal({ changelog, onClose }: Props): JSX.Element {
|
||||
updateUserPreferenceInContext,
|
||||
]);
|
||||
|
||||
const checkScroll = useCallback((): void => {
|
||||
if (changelogContentSectionRef.current) {
|
||||
const { scrollHeight, clientHeight, scrollTop } =
|
||||
changelogContentSectionRef.current;
|
||||
const isAtBottom = scrollHeight - clientHeight - scrollTop <= 8;
|
||||
setHasScroll(scrollHeight > clientHeight + 24 && !isAtBottom); // 24px - buffer height to show show more
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
checkScroll();
|
||||
const changelogContentSection = changelogContentSectionRef.current;
|
||||
|
||||
if (changelogContentSection) {
|
||||
changelogContentSection.addEventListener('scroll', checkScroll);
|
||||
}
|
||||
|
||||
return (): void => {
|
||||
if (changelogContentSection) {
|
||||
changelogContentSection.removeEventListener('scroll', checkScroll);
|
||||
}
|
||||
};
|
||||
}, [checkScroll]);
|
||||
|
||||
const onClickUpdateWorkspace = (): void => {
|
||||
window.open(
|
||||
'https://signoz.io/upgrade-path',
|
||||
@@ -64,61 +89,75 @@ function ChangelogModal({ changelog, onClose }: Props): JSX.Element {
|
||||
);
|
||||
};
|
||||
|
||||
const onClickScrollForMore = (): void => {
|
||||
if (changelogContentSectionRef.current) {
|
||||
changelogContentSectionRef.current.scrollTo({
|
||||
top: changelogContentSectionRef.current.scrollTop + 600, // Scroll 600px from the current position
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// 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 (
|
||||
<Dialog
|
||||
<Modal
|
||||
className={cx('changelog-modal')}
|
||||
title={
|
||||
<div className="changelog-modal-title">
|
||||
<ScrollText size={16} />
|
||||
What’s New ⎯ Changelog : {formattedReleaseDate}
|
||||
</div>
|
||||
}
|
||||
width={820}
|
||||
open
|
||||
onClose={onClose}
|
||||
title={`What’s New ⎯ Changelog : ${formattedReleaseDate}`}
|
||||
titleIcon={<ScrollText size={16} />}
|
||||
width="extra-wide"
|
||||
testId="changelog-dialog"
|
||||
footerSuffix={
|
||||
isCloudUser ? undefined : (
|
||||
<>
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
size="md"
|
||||
prefix={<X size={12} />}
|
||||
onClick={onClose}
|
||||
testId="changelog-skip-btn"
|
||||
>
|
||||
Skip for now
|
||||
</Button>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="primary"
|
||||
size="md"
|
||||
prefix={<Check size={12} />}
|
||||
onClick={onClickUpdateWorkspace}
|
||||
testId="changelog-update-btn"
|
||||
>
|
||||
Update my workspace
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
onCancel={onClose}
|
||||
footer={
|
||||
<div
|
||||
className={cx('changelog-modal-footer', hasScroll && 'scroll-available')}
|
||||
>
|
||||
{!isCloudUser && (
|
||||
<div className="changelog-modal-footer-ctas">
|
||||
<Button type="default" onClick={onClose}>
|
||||
<Flex align="center" gap="4px">
|
||||
<X size="md" />
|
||||
Skip for now
|
||||
</Flex>
|
||||
</Button>
|
||||
<Button type="primary" onClick={onClickUpdateWorkspace}>
|
||||
<Flex align="center" gap="4px">
|
||||
<Check size="md" />
|
||||
Update my workspace
|
||||
</Flex>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{changelog && (
|
||||
<div className="scroll-btn-container">
|
||||
<button
|
||||
data-testid="scroll-more-btn"
|
||||
type="button"
|
||||
className="scroll-btn"
|
||||
onClick={onClickScrollForMore}
|
||||
>
|
||||
<ChevronsDown size={14} />
|
||||
<span>Scroll for more</span>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div data-testid="changelog-content" ref={contentRef}>
|
||||
<ChangelogRenderer changelog={changelog} />
|
||||
<div
|
||||
className="changelog-modal-content"
|
||||
data-testid="changelog-content"
|
||||
ref={changelogContentSectionRef}
|
||||
>
|
||||
{changelog && <ChangelogRenderer changelog={changelog} />}
|
||||
</div>
|
||||
{hasScroll && (
|
||||
<div className={styles.scrollHint}>
|
||||
<div className={styles.scrollButton}>
|
||||
<Button
|
||||
variant="solid"
|
||||
color="primary"
|
||||
size="sm"
|
||||
prefix={<ChevronsDown size={14} className={styles.scrollIcon} />}
|
||||
onClick={scrollForMore}
|
||||
testId="scroll-more-btn"
|
||||
>
|
||||
Scroll for more
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Dialog>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
import { ReactNode } from 'react';
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { USER_PREFERENCES } from 'constants/userPreferences';
|
||||
import { IAppContext } from 'providers/App/types';
|
||||
import {
|
||||
fireEvent,
|
||||
getAppContextMock,
|
||||
render,
|
||||
screen,
|
||||
userEvent,
|
||||
waitFor,
|
||||
} from 'tests/test-utils';
|
||||
import MockQueryClientProvider from 'providers/test/MockQueryClientProvider';
|
||||
import {
|
||||
ChangelogSchema,
|
||||
DeploymentType,
|
||||
} from 'types/api/changelog/getChangelogByVersion';
|
||||
import {
|
||||
LicensePlatform,
|
||||
LicenseResModel,
|
||||
} from 'types/api/licensesV3/getActive';
|
||||
import { UserPreference } from 'types/api/preferences/preference';
|
||||
|
||||
import ChangelogModal from '../ChangelogModal';
|
||||
|
||||
@@ -51,165 +40,71 @@ const mockChangelog: ChangelogSchema = {
|
||||
jest.mock(
|
||||
'react-markdown',
|
||||
() =>
|
||||
function ReactMarkdown({ children }: { children: ReactNode }): JSX.Element {
|
||||
function ReactMarkdown({ children }: any) {
|
||||
return <div>{children}</div>;
|
||||
},
|
||||
);
|
||||
|
||||
const seenChangelogVersion: UserPreference = {
|
||||
name: USER_PREFERENCES.LAST_SEEN_CHANGELOG_VERSION,
|
||||
description: '',
|
||||
valueType: 'string',
|
||||
defaultValue: '',
|
||||
allowedValues: [],
|
||||
allowedScopes: ['user'],
|
||||
value: 'v1.0.0',
|
||||
};
|
||||
|
||||
const selfHostedContext: Partial<IAppContext> = {
|
||||
activeLicense: {
|
||||
...(getAppContextMock('ADMIN').activeLicense as LicenseResModel),
|
||||
platform: LicensePlatform.SELF_HOSTED,
|
||||
},
|
||||
};
|
||||
|
||||
function renderChangelog(
|
||||
onClose: () => void = jest.fn(),
|
||||
appContextOverrides: Partial<IAppContext> = {},
|
||||
): void {
|
||||
render(
|
||||
<ChangelogModal changelog={mockChangelog} onClose={onClose} />,
|
||||
undefined,
|
||||
{
|
||||
appContextOverrides: {
|
||||
userPreferences: [seenChangelogVersion],
|
||||
...appContextOverrides,
|
||||
// mock useAppContext
|
||||
jest.mock('providers/App/App', () => ({
|
||||
useAppContext: jest.fn(() => ({
|
||||
updateUserPreferenceInContext: jest.fn(),
|
||||
userPreferences: [
|
||||
{
|
||||
name: USER_PREFERENCES.LAST_SEEN_CHANGELOG_VERSION,
|
||||
value: 'v1.0.0',
|
||||
},
|
||||
},
|
||||
],
|
||||
})),
|
||||
}));
|
||||
|
||||
function renderChangelog(onClose: () => void = jest.fn()): void {
|
||||
render(
|
||||
<MockQueryClientProvider>
|
||||
<ChangelogModal changelog={mockChangelog} onClose={onClose} />
|
||||
</MockQueryClientProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('ChangelogModal', () => {
|
||||
it('renders the dialog with the changelog data', async () => {
|
||||
it('renders modal with changelog data', () => {
|
||||
renderChangelog();
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('changelog-dialog-title'),
|
||||
).resolves.toHaveTextContent('What’s New ⎯ Changelog : June 10, 2025');
|
||||
expect(
|
||||
screen.getByText('What’s New ⎯ Changelog : June 10, 2025'),
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText('Feature 1')).toBeInTheDocument();
|
||||
expect(screen.getByText('Description for feature 1')).toBeInTheDocument();
|
||||
expect(screen.getByText('Bug fix details')).toBeInTheDocument();
|
||||
expect(screen.getByText('Maintenance details')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('calls onClose when the close button is clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
it('calls onClose when Skip for now is clicked', () => {
|
||||
const onClose = jest.fn();
|
||||
renderChangelog(onClose);
|
||||
|
||||
await user.click(await screen.findByTestId('changelog-dialog-close'));
|
||||
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
fireEvent.click(screen.getByText('Skip for now'));
|
||||
expect(onClose).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('offers no upgrade actions to a cloud workspace', async () => {
|
||||
it('opens migration docs when Update my workspace is clicked', () => {
|
||||
window.open = jest.fn();
|
||||
renderChangelog();
|
||||
|
||||
await screen.findByTestId('changelog-content');
|
||||
|
||||
expect(
|
||||
screen.queryByTestId('changelog-dialog-footer'),
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('changelog-skip-btn')).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('changelog-update-btn')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('calls onClose when Skip for now is clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const onClose = jest.fn();
|
||||
renderChangelog(onClose, selfHostedContext);
|
||||
|
||||
await user.click(await screen.findByTestId('changelog-skip-btn'));
|
||||
|
||||
expect(onClose).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('opens migration docs when Update my workspace is clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const open = jest.spyOn(window, 'open').mockImplementation(() => null);
|
||||
renderChangelog(jest.fn(), selfHostedContext);
|
||||
|
||||
await user.click(await screen.findByTestId('changelog-update-btn'));
|
||||
|
||||
expect(open).toHaveBeenCalledWith(
|
||||
fireEvent.click(screen.getByText('Update my workspace'));
|
||||
expect(window.open).toHaveBeenCalledWith(
|
||||
'https://signoz.io/upgrade-path',
|
||||
'_blank',
|
||||
'noopener,noreferrer',
|
||||
);
|
||||
open.mockRestore();
|
||||
});
|
||||
|
||||
describe('scroll for more', () => {
|
||||
let scrollHeight: jest.SpyInstance;
|
||||
let clientHeight: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
scrollHeight = jest.spyOn(Element.prototype, 'scrollHeight', 'get');
|
||||
clientHeight = jest.spyOn(Element.prototype, 'clientHeight', 'get');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
scrollHeight.mockRestore();
|
||||
clientHeight.mockRestore();
|
||||
});
|
||||
|
||||
it('is hidden while the content fits', async () => {
|
||||
scrollHeight.mockReturnValue(400);
|
||||
clientHeight.mockReturnValue(400);
|
||||
renderChangelog();
|
||||
|
||||
await screen.findByTestId('changelog-content');
|
||||
|
||||
expect(screen.queryByTestId('scroll-more-btn')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('scrolls 600px further from the current position when clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
scrollHeight.mockReturnValue(2000);
|
||||
clientHeight.mockReturnValue(400);
|
||||
renderChangelog();
|
||||
|
||||
const content = await screen.findByTestId('changelog-dialog-body');
|
||||
Object.defineProperty(content, 'scrollTop', {
|
||||
value: 100,
|
||||
configurable: true,
|
||||
});
|
||||
const scrollTo = jest.fn();
|
||||
Object.defineProperty(content, 'scrollTo', { value: scrollTo });
|
||||
await user.click(await screen.findByTestId('scroll-more-btn'));
|
||||
|
||||
expect(scrollTo).toHaveBeenCalledWith({
|
||||
top: 700,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
});
|
||||
|
||||
it('hides once the content is scrolled to the bottom', async () => {
|
||||
scrollHeight.mockReturnValue(1000);
|
||||
clientHeight.mockReturnValue(400);
|
||||
renderChangelog();
|
||||
|
||||
const content = await screen.findByTestId('changelog-dialog-body');
|
||||
await screen.findByTestId('scroll-more-btn');
|
||||
Object.defineProperty(content, 'scrollTop', {
|
||||
value: 600,
|
||||
configurable: true,
|
||||
});
|
||||
fireEvent.scroll(content);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.queryByTestId('scroll-more-btn')).not.toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
it('scrolls for more when Scroll for more is clicked', () => {
|
||||
renderChangelog();
|
||||
const scrollBtn = screen.getByTestId('scroll-more-btn');
|
||||
const contentDiv = screen.getByTestId('changelog-content');
|
||||
if (contentDiv) {
|
||||
contentDiv.scrollTo = jest.fn();
|
||||
}
|
||||
fireEvent.click(scrollBtn);
|
||||
if (contentDiv) {
|
||||
expect(contentDiv.scrollTo).toHaveBeenCalled();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
&-line {
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
left: 0;
|
||||
top: 6px;
|
||||
bottom: -30px;
|
||||
width: 1px;
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
const SCROLL_STEP_PX = 600;
|
||||
const MIN_OVERFLOW_PX = 24;
|
||||
const BOTTOM_TOLERANCE_PX = 8;
|
||||
|
||||
interface UseChangelogScrollReturn {
|
||||
contentRef: (node: HTMLDivElement | null) => void;
|
||||
hasScroll: boolean;
|
||||
scrollForMore: () => void;
|
||||
}
|
||||
|
||||
export function useChangelogScroll(): UseChangelogScrollReturn {
|
||||
const [content, setContent] = useState<HTMLElement | null>(null);
|
||||
const [hasScroll, setHasScroll] = useState(false);
|
||||
|
||||
const checkScroll = useCallback((): void => {
|
||||
if (!content) {
|
||||
return;
|
||||
}
|
||||
const { scrollHeight, clientHeight, scrollTop } = content;
|
||||
const isAtBottom =
|
||||
scrollHeight - clientHeight - scrollTop <= BOTTOM_TOLERANCE_PX;
|
||||
setHasScroll(scrollHeight > clientHeight + MIN_OVERFLOW_PX && !isAtBottom);
|
||||
}, [content]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!content) {
|
||||
return undefined;
|
||||
}
|
||||
checkScroll();
|
||||
content.addEventListener('scroll', checkScroll);
|
||||
|
||||
return (): void => {
|
||||
content.removeEventListener('scroll', checkScroll);
|
||||
};
|
||||
}, [content, checkScroll]);
|
||||
|
||||
const scrollForMore = useCallback((): void => {
|
||||
content?.scrollTo({
|
||||
top: content.scrollTop + SCROLL_STEP_PX,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
}, [content]);
|
||||
|
||||
// The dialog body owns the scroll; a second scroller inside it shows two scrollbars.
|
||||
const contentRef = useCallback((node: HTMLDivElement | null): void => {
|
||||
setContent(node?.closest<HTMLElement>('[data-slot="dialog-body"]') ?? null);
|
||||
}, []);
|
||||
|
||||
return { contentRef, hasScroll, scrollForMore };
|
||||
}
|
||||
@@ -68,7 +68,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('submit button becomes disabled after clearing the name field', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderModal();
|
||||
|
||||
const nameInput = await screen.findByTestId('create-sa-name-input-field');
|
||||
@@ -86,7 +86,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('successful submit shows toast.success and closes modal', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderModal();
|
||||
|
||||
const nameInput = await screen.findByTestId('create-sa-name-input-field');
|
||||
@@ -112,7 +112,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('pressing Enter again while creating sends one request', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
let requests = 0;
|
||||
server.use(
|
||||
rest.post(SERVICE_ACCOUNTS_ENDPOINT, (_, res, ctx) => {
|
||||
@@ -146,7 +146,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('shows toast.error on API error and keeps modal open', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
server.use(
|
||||
rest.post(SERVICE_ACCOUNTS_ENDPOINT, (_, res, ctx) =>
|
||||
@@ -186,7 +186,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('Cancel button closes modal without submitting', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderModal();
|
||||
|
||||
const cancelBtn = await screen.findByTestId('create-sa-cancel-btn');
|
||||
@@ -217,7 +217,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('keeps the footer usable when create permission is denied', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
server.use(setupAuthzDenyAll());
|
||||
|
||||
renderModal();
|
||||
@@ -242,7 +242,7 @@ describe('CreateServiceAccountModal', () => {
|
||||
});
|
||||
|
||||
it('shows "Name is required" after clearing the name field', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderModal();
|
||||
|
||||
const nameInput = await screen.findByTestId('create-sa-name-input-field');
|
||||
|
||||
@@ -5,7 +5,7 @@ import dayjs from 'dayjs';
|
||||
import { Calendar as CalendarIcon, Check, X } from '@signozhq/icons';
|
||||
import { useTimezone } from 'providers/Timezone';
|
||||
|
||||
import type { DateRange } from './CustomTimePickerPopoverContent';
|
||||
import { DateRange } from './CustomTimePickerPopoverContent';
|
||||
|
||||
function CalendarContainer({
|
||||
dateRange,
|
||||
@@ -50,7 +50,7 @@ function CalendarContainer({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="calendar-container" data-testid="calendar-container">
|
||||
<div className="calendar-container">
|
||||
<div className="calendar-container-header">
|
||||
<CalendarIcon size={12} />
|
||||
<div className="calendar-container-header-title">
|
||||
@@ -80,7 +80,6 @@ function CalendarContainer({
|
||||
<Button
|
||||
type="primary"
|
||||
className="periscope-btn secondary cancel-btn"
|
||||
data-testid="calendar-cancel-btn"
|
||||
onClick={onCancel}
|
||||
icon={<X size={12} />}
|
||||
>
|
||||
@@ -89,7 +88,6 @@ function CalendarContainer({
|
||||
<Button
|
||||
type="primary"
|
||||
className="periscope-btn primary apply-btn"
|
||||
data-testid="calendar-apply-btn"
|
||||
onClick={onApply}
|
||||
icon={<Check size={12} />}
|
||||
>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
.calendarContainerFallback {
|
||||
justify-content: center;
|
||||
// Header, caption, weekday row and actions take 160px; each week row 40px.
|
||||
min-height: calc(160px + var(--calendar-week-count) * 40px);
|
||||
color: var(--l2-foreground);
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { CSSProperties } from 'react';
|
||||
import { Spinner } from '@signozhq/ui/spinner';
|
||||
import cx from 'classnames';
|
||||
|
||||
import { getCalendarWeekCount } from './calendarUtils';
|
||||
|
||||
import styles from './CalendarContainerFallback.module.scss';
|
||||
|
||||
function CalendarContainerFallback({
|
||||
month,
|
||||
}: {
|
||||
month: Date | undefined;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<div
|
||||
className={cx('calendar-container', styles.calendarContainerFallback)}
|
||||
style={
|
||||
{ '--calendar-week-count': getCalendarWeekCount(month) } as CSSProperties
|
||||
}
|
||||
data-testid="calendar-container-fallback"
|
||||
aria-busy="true"
|
||||
>
|
||||
<Spinner size={20} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CalendarContainerFallback;
|
||||
@@ -67,6 +67,21 @@
|
||||
color: var(--bg-cherry-400) !important;
|
||||
}
|
||||
|
||||
.info-text {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4px;
|
||||
cursor: default;
|
||||
color: var(--l2-foreground) !important;
|
||||
}
|
||||
|
||||
.info-text:hover {
|
||||
&.ant-btn-text {
|
||||
background-color: unset !important;
|
||||
}
|
||||
}
|
||||
|
||||
.date-time-popover__footer {
|
||||
border-top: 1px solid var(--l1-border);
|
||||
padding: 8px 14px;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { fireEvent, screen, userEvent } from 'tests/test-utils';
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import dayjs from 'dayjs';
|
||||
import { mockAppLocation } from 'tests/router-mocks';
|
||||
import * as timeUtils from 'utils/timeUtils';
|
||||
@@ -158,8 +157,7 @@ describe('CustomTimePicker', () => {
|
||||
expect(onValid).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('treats close after change like pressing Enter (blur + chevron)', async () => {
|
||||
const user = userEvent.setup();
|
||||
it('treats close after change like pressing Enter (blur + chevron)', () => {
|
||||
const onValid = jest.fn();
|
||||
const onError = jest.fn();
|
||||
|
||||
@@ -168,13 +166,16 @@ describe('CustomTimePicker', () => {
|
||||
const input = screen.getByRole('textbox');
|
||||
|
||||
// Open and change value so "changed since open" is true
|
||||
await user.click(input);
|
||||
await user.clear(input);
|
||||
await user.type(input, '5m');
|
||||
await user.tab();
|
||||
fireEvent.focus(input);
|
||||
fireEvent.change(input, { target: { value: '5m' } });
|
||||
fireEvent.blur(input);
|
||||
|
||||
// Click the chevron (which triggers handleClose)
|
||||
await user.click(screen.getByTestId('time-picker-close-chevron'));
|
||||
const chevron = document.querySelector(
|
||||
'.time-input-suffix-icon-badge',
|
||||
) as HTMLElement;
|
||||
|
||||
fireEvent.click(chevron);
|
||||
|
||||
// Should have applied the value (same as Enter)
|
||||
expect(onValid).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -640,14 +640,12 @@ function CustomTimePicker({
|
||||
size={14}
|
||||
className="cursor-pointer time-input-suffix-icon-badge"
|
||||
onClick={handleClose}
|
||||
data-testid="time-picker-close-chevron"
|
||||
/>
|
||||
) : (
|
||||
<ChevronDown
|
||||
size={14}
|
||||
className="cursor-pointer time-input-suffix-icon-badge"
|
||||
onClick={handleOpen}
|
||||
data-testid="time-picker-open-chevron"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import {
|
||||
Dispatch,
|
||||
lazy,
|
||||
SetStateAction,
|
||||
Suspense,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
@@ -26,20 +24,15 @@ import dayjs from 'dayjs';
|
||||
import { Clock, PenLine, TriangleAlert } from '@signozhq/icons';
|
||||
import { useTimezone } from 'providers/Timezone';
|
||||
import { getCustomTimeRanges } from 'utils/customTimeRangeUtils';
|
||||
import { lazyRetry } from 'utils/lazyWithRetries';
|
||||
import { TimeRangeValidationResult } from 'utils/timeUtils';
|
||||
|
||||
import CalendarContainerFallback from './CalendarContainerFallback';
|
||||
import CalendarContainer from './CalendarContainer';
|
||||
import { CustomTimePickerInputStatus } from './CustomTimePicker';
|
||||
import TimezonePicker from './TimezonePicker';
|
||||
import { Timezone } from './timezoneUtils';
|
||||
|
||||
import './CustomTimePicker.styles.scss';
|
||||
|
||||
const CalendarContainer = lazy(() =>
|
||||
lazyRetry(() => import('./CalendarContainer')),
|
||||
);
|
||||
|
||||
const TO_MILLISECONDS_FACTOR = 1000_000;
|
||||
|
||||
export type DateRange = {
|
||||
@@ -298,16 +291,12 @@ function CustomTimePickerPopoverContent({
|
||||
)}
|
||||
>
|
||||
{customDateTimeVisible ? (
|
||||
<Suspense
|
||||
fallback={<CalendarContainerFallback month={dateRange?.from} />}
|
||||
>
|
||||
<CalendarContainer
|
||||
dateRange={dateRange}
|
||||
onSelectDateRange={handleSelectDateRange}
|
||||
onCancel={handleCalendarRangeCancel}
|
||||
onApply={handleCalendarRangeApply}
|
||||
/>
|
||||
</Suspense>
|
||||
<CalendarContainer
|
||||
dateRange={dateRange}
|
||||
onSelectDateRange={handleSelectDateRange}
|
||||
onCancel={handleCalendarRangeCancel}
|
||||
onApply={handleCalendarRangeApply}
|
||||
/>
|
||||
) : (
|
||||
<div className="time-selector-container">
|
||||
{customDateTimeInputStatus === CustomTimePickerInputStatus.ERROR &&
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
import dayjs from 'dayjs';
|
||||
import { render, screen, userEvent, within } from 'tests/test-utils';
|
||||
|
||||
import CustomTimePickerPopoverContent from '../CustomTimePickerPopoverContent';
|
||||
import { CustomTimePickerInputStatus } from '../CustomTimePicker';
|
||||
|
||||
const NANOSECONDS_PER_MILLISECOND = 1_000_000;
|
||||
|
||||
const minTime =
|
||||
dayjs('2024-01-01 00:00:00').valueOf() * NANOSECONDS_PER_MILLISECOND;
|
||||
const maxTime =
|
||||
dayjs('2024-01-03 00:00:00').valueOf() * NANOSECONDS_PER_MILLISECOND;
|
||||
|
||||
interface RenderOptions {
|
||||
customDateTimeVisible: boolean;
|
||||
setIsOpen?: jest.Mock;
|
||||
setCustomDTPickerVisible?: jest.Mock;
|
||||
onCustomDateHandler?: jest.Mock;
|
||||
}
|
||||
|
||||
function renderPopoverContent({
|
||||
customDateTimeVisible,
|
||||
setIsOpen = jest.fn(),
|
||||
setCustomDTPickerVisible = jest.fn(),
|
||||
onCustomDateHandler = jest.fn(),
|
||||
}: RenderOptions): void {
|
||||
render(
|
||||
<CustomTimePickerPopoverContent
|
||||
isLiveLogsEnabled={false}
|
||||
minTime={minTime}
|
||||
maxTime={maxTime}
|
||||
options={[
|
||||
{ label: 'Last 5 minutes', value: '5m' },
|
||||
{ label: 'Custom Date Range', value: 'custom' },
|
||||
]}
|
||||
setIsOpen={setIsOpen}
|
||||
customDateTimeVisible={customDateTimeVisible}
|
||||
setCustomDTPickerVisible={setCustomDTPickerVisible}
|
||||
onCustomDateHandler={onCustomDateHandler}
|
||||
onSelectHandler={jest.fn()}
|
||||
onTimezoneChange={jest.fn()}
|
||||
onGoLive={jest.fn()}
|
||||
selectedTime="custom"
|
||||
activeView="datetime"
|
||||
setActiveView={jest.fn()}
|
||||
isOpenedFromFooter={false}
|
||||
setIsOpenedFromFooter={jest.fn()}
|
||||
onExitLiveLogs={jest.fn()}
|
||||
showRecentlyUsed={false}
|
||||
customDateTimeInputStatus={CustomTimePickerInputStatus.UNSET}
|
||||
inputErrorDetails={null}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('CustomTimePickerPopoverContent calendar', () => {
|
||||
it('keeps the calendar out of the popover while relative times show', () => {
|
||||
renderPopoverContent({ customDateTimeVisible: false });
|
||||
|
||||
expect(screen.getByTestId('time-option-5m')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByTestId('calendar-container-fallback'),
|
||||
).not.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('calendar-container')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('holds the calendar slot with a fallback until the calendar loads', async () => {
|
||||
renderPopoverContent({ customDateTimeVisible: true });
|
||||
|
||||
expect(
|
||||
screen
|
||||
.getByTestId('calendar-container-fallback')
|
||||
.style.getPropertyValue('--calendar-week-count'),
|
||||
).toBe('5');
|
||||
|
||||
await expect(
|
||||
screen.findByTestId('calendar-container'),
|
||||
).resolves.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByTestId('calendar-container-fallback'),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('closes the calendar view when Cancel is clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const setCustomDTPickerVisible = jest.fn();
|
||||
renderPopoverContent({
|
||||
customDateTimeVisible: true,
|
||||
setCustomDTPickerVisible,
|
||||
});
|
||||
|
||||
await user.click(await screen.findByTestId('calendar-cancel-btn'));
|
||||
|
||||
expect(setCustomDTPickerVisible).toHaveBeenCalledWith(false);
|
||||
});
|
||||
|
||||
it('applies the selected range and closes the popover when Apply is clicked', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const setIsOpen = jest.fn();
|
||||
const onCustomDateHandler = jest.fn();
|
||||
renderPopoverContent({
|
||||
customDateTimeVisible: true,
|
||||
setIsOpen,
|
||||
onCustomDateHandler,
|
||||
});
|
||||
|
||||
await user.click(await screen.findByTestId('calendar-apply-btn'));
|
||||
|
||||
expect(onCustomDateHandler).toHaveBeenCalledTimes(1);
|
||||
const [[from, to]] = onCustomDateHandler.mock.calls[0];
|
||||
expect(to.diff(from, 'hour')).toBe(71);
|
||||
expect(setIsOpen).toHaveBeenCalledWith(false);
|
||||
});
|
||||
|
||||
it('applies a range picked on the calendar', async () => {
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const onCustomDateHandler = jest.fn();
|
||||
renderPopoverContent({ customDateTimeVisible: true, onCustomDateHandler });
|
||||
|
||||
const calendar = await screen.findByTestId('calendar-container');
|
||||
await user.click(
|
||||
within(calendar).getByRole('button', { name: /January 12th, 2024/ }),
|
||||
);
|
||||
await user.click(
|
||||
within(calendar).getByRole('button', { name: /January 10th, 2024/ }),
|
||||
);
|
||||
await user.click(screen.getByTestId('calendar-apply-btn'));
|
||||
|
||||
expect(onCustomDateHandler).toHaveBeenCalledTimes(1);
|
||||
const [[from, to]] = onCustomDateHandler.mock.calls[0];
|
||||
expect(from.format('YYYY-MM-DD HH:mm')).toBe('2024-01-10 00:00');
|
||||
expect(to.format('YYYY-MM-DD HH:mm')).toBe('2024-01-12 23:59');
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import { getCalendarWeekCount } from '../calendarUtils';
|
||||
|
||||
describe('getCalendarWeekCount', () => {
|
||||
it.each([
|
||||
['February 2026', new Date(2026, 1, 14), 4],
|
||||
['January 2024', new Date(2024, 0, 31), 5],
|
||||
['June 2024', new Date(2024, 5, 1), 6],
|
||||
])('counts the week rows of %s', (_month, date, weeks) => {
|
||||
expect(getCalendarWeekCount(date)).toBe(weeks);
|
||||
});
|
||||
});
|
||||
@@ -1,8 +0,0 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
/** Week rows the calendar renders for `month`, with weeks starting on Sunday. */
|
||||
export function getCalendarWeekCount(month: Date | undefined): number {
|
||||
const firstDay = dayjs(month).startOf('month');
|
||||
|
||||
return Math.ceil((firstDay.day() + firstDay.daysInMonth()) / 7);
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||
import dayjs from 'dayjs';
|
||||
import { screen, userEvent } from 'storybook/test';
|
||||
|
||||
import { withCanvas } from '@/storybook/decorators/withCanvas';
|
||||
|
||||
import CustomTimePicker from '../CustomTimePicker';
|
||||
import {
|
||||
openCustomRangeCalendar,
|
||||
openRelativeTimes,
|
||||
openTimezoneMenu,
|
||||
} from './__story_mockdata__/customTimePicker.play';
|
||||
|
||||
const minTime = dayjs('2025-01-15T11:00:00Z').valueOf() * 1_000_000;
|
||||
const maxTime = dayjs('2025-01-15T12:00:00Z').valueOf() * 1_000_000;
|
||||
@@ -17,11 +13,9 @@ const maxTime = dayjs('2025-01-15T12:00:00Z').valueOf() * 1_000_000;
|
||||
function TimePickerFixture(): JSX.Element {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [selectedTime, setSelectedTime] = useState('1h');
|
||||
const [customDTPickerVisible, setCustomDTPickerVisible] = useState(false);
|
||||
|
||||
return (
|
||||
<CustomTimePicker
|
||||
customDateTimeVisible={customDTPickerVisible}
|
||||
isModalTimeSelection
|
||||
items={[
|
||||
{ label: 'Last 15 minutes', value: '15m' },
|
||||
@@ -39,7 +33,6 @@ function TimePickerFixture(): JSX.Element {
|
||||
onValidCustomDateChange={(): void => undefined}
|
||||
selectedTime={selectedTime}
|
||||
selectedValue="15 Jan 2025 11:00:00 - 15 Jan 2025 12:00:00"
|
||||
setCustomDTPickerVisible={setCustomDTPickerVisible}
|
||||
setOpen={setOpen}
|
||||
/>
|
||||
);
|
||||
@@ -58,15 +51,19 @@ type Story = StoryObj<typeof meta>;
|
||||
|
||||
/** Interaction: the time-range menu is open with its relative-range choices. */
|
||||
export const TimeRangeMenuOpen: Story = {
|
||||
play: openRelativeTimes,
|
||||
play: async (): Promise<void> => {
|
||||
await userEvent.click(await screen.findByRole('textbox'));
|
||||
await screen.findByText('RELATIVE TIMES');
|
||||
},
|
||||
};
|
||||
|
||||
/** Interaction: the timezone menu is reached through the real time-range footer. */
|
||||
export const TimezoneMenuOpen: Story = {
|
||||
play: openTimezoneMenu,
|
||||
};
|
||||
|
||||
/** Interaction: Custom opens the range calendar on the current day range. */
|
||||
export const CustomRangeCalendarOpen: Story = {
|
||||
play: openCustomRangeCalendar,
|
||||
play: async (): Promise<void> => {
|
||||
await userEvent.click(await screen.findByRole('textbox'));
|
||||
await userEvent.click(
|
||||
await screen.findByRole('button', { name: 'Change Timezone' }),
|
||||
);
|
||||
await screen.findByPlaceholderText('Search timezones...');
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* AI-owned. Generated and maintained by the `signoz-page-story` skill.
|
||||
* Do not hand-edit: regenerate instead.
|
||||
*/
|
||||
|
||||
import { expect, screen, userEvent, within } from 'storybook/test';
|
||||
|
||||
const openTimeRangeMenu = async (): Promise<void> => {
|
||||
await userEvent.click(await screen.findByRole('textbox'));
|
||||
await screen.findByTestId('time-option-custom');
|
||||
};
|
||||
|
||||
export const openRelativeTimes = async (): Promise<void> => {
|
||||
await openTimeRangeMenu();
|
||||
await screen.findByText('RELATIVE TIMES');
|
||||
};
|
||||
|
||||
export const openTimezoneMenu = async (): Promise<void> => {
|
||||
await openTimeRangeMenu();
|
||||
await userEvent.click(
|
||||
await screen.findByRole('button', { name: 'Change Timezone' }),
|
||||
);
|
||||
await screen.findByPlaceholderText('Search timezones...');
|
||||
};
|
||||
|
||||
/** The calendar loads in its own chunk, so it is awaited past the fallback. */
|
||||
export const openCustomRangeCalendar = async (): Promise<void> => {
|
||||
await openTimeRangeMenu();
|
||||
await userEvent.click(screen.getByTestId('time-option-custom'));
|
||||
|
||||
const calendar = await screen.findByTestId(
|
||||
'calendar-container',
|
||||
{},
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
await expect(
|
||||
within(calendar).getByTestId('calendar-apply-btn'),
|
||||
).toBeInTheDocument();
|
||||
};
|
||||
@@ -24,4 +24,10 @@
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&__nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,6 @@ export default function DownloadOptionsMenu({
|
||||
arrow={false}
|
||||
open={isPopoverOpen}
|
||||
onOpenChange={setIsPopoverOpen}
|
||||
destroyTooltipOnHide
|
||||
rootClassName="download-popover"
|
||||
>
|
||||
<Tooltip title="Download" placement="top">
|
||||
|
||||
@@ -273,7 +273,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('enables Save after editing name and calls updateUser on confirm', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const mockMutateAsync = jest.fn().mockResolvedValue({});
|
||||
|
||||
(useUpdateUser as jest.Mock).mockReturnValue({
|
||||
@@ -306,7 +306,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('does not close the drawer after a successful save', async () => {
|
||||
const onClose = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderDrawer({ onClose });
|
||||
|
||||
@@ -331,7 +331,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('adding a new role creates a user role without removing existing ones', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const mockSet = jest.fn().mockResolvedValue({});
|
||||
|
||||
(useCreateUserRole as jest.Mock).mockReturnValue({
|
||||
@@ -365,7 +365,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('deselecting a role deletes the user role by its assignment id', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderDrawer({ onComplete });
|
||||
|
||||
@@ -392,7 +392,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('shows delete confirm dialog and calls deleteUser for active members', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
|
||||
mutateAsync: mockDeleteMutate.mockImplementation(() => {
|
||||
@@ -553,7 +553,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('calls deleteUser after confirming revoke invite for invited members', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
|
||||
mutateAsync: mockDeleteMutate.mockImplementation(() => {
|
||||
@@ -583,7 +583,7 @@ describe('EditMemberDrawer', () => {
|
||||
|
||||
it('calls updateUser when saving name change for an invited member', async () => {
|
||||
const onComplete = jest.fn();
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const mockMutateAsync = jest.fn().mockResolvedValue({});
|
||||
|
||||
(useGetUser as jest.Mock).mockReturnValue({
|
||||
@@ -641,7 +641,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('shows SaveErrorItem when updateUser fails for name change', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
(useUpdateUser as jest.Mock).mockReturnValue({
|
||||
mutateAsync: jest.fn().mockRejectedValue(new Error('server error')),
|
||||
@@ -669,7 +669,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('shows API error message when deleteUser fails for active member', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
|
||||
mutateAsync: mockDeleteMutate.mockImplementation(() => {
|
||||
@@ -700,7 +700,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('shows API error message when deleteUser fails for invited member', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
(useDeleteUser as jest.Mock).mockImplementation((options) => ({
|
||||
mutateAsync: mockDeleteMutate.mockImplementation(() => {
|
||||
@@ -740,7 +740,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('does not open delete confirm dialog when Delete is clicked while disabled (isSelf)', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderDrawer({ member: selfMember });
|
||||
|
||||
await user.click(screen.getByRole('button', { name: /delete member/i }));
|
||||
@@ -771,11 +771,7 @@ describe('EditMemberDrawer', () => {
|
||||
it('keeps roles editable', async () => {
|
||||
renderDrawer({ member: selfMember });
|
||||
|
||||
await expect(
|
||||
screen.findByTestId(
|
||||
`member-roles-select-chip-${managedRoles[0].id}-remove`,
|
||||
),
|
||||
).resolves.toBeInTheDocument();
|
||||
await expect(screen.findByText('Select roles')).resolves.toBeInTheDocument();
|
||||
expect(screen.queryByTestId('member-roles-locked')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -811,7 +807,7 @@ describe('EditMemberDrawer', () => {
|
||||
isLoading: false,
|
||||
});
|
||||
server.use(setupAuthzDeny(buildUserUpdatePermission(selfMember.id)));
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderDrawer({ member: selfMember });
|
||||
|
||||
const input = await screen.findByDisplayValue('Alice Smith');
|
||||
@@ -875,7 +871,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('does not open delete confirm dialog when Delete is clicked while disabled (root)', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderDrawer();
|
||||
|
||||
await user.click(screen.getByRole('button', { name: /delete member/i }));
|
||||
@@ -886,7 +882,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('does not call createResetPasswordToken when Reset Link is clicked while disabled (root)', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
renderDrawer();
|
||||
|
||||
await user.click(
|
||||
@@ -903,7 +899,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('calls POST and opens the reset link dialog with the generated link and expiry', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
|
||||
renderDrawer();
|
||||
|
||||
@@ -925,7 +921,7 @@ describe('EditMemberDrawer', () => {
|
||||
});
|
||||
|
||||
it('copies the link to clipboard and shows "Copied!" on the button', async () => {
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
const mockToast = jest.mocked(toast);
|
||||
|
||||
renderDrawer();
|
||||
|
||||
@@ -53,7 +53,7 @@ describe('ErrorModal Component', () => {
|
||||
|
||||
// Click the close button
|
||||
const closeButton = screen.getByTestId('close-button');
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
await user.click(closeButton);
|
||||
|
||||
// Check if onClose was called
|
||||
@@ -145,7 +145,7 @@ it('should open the modal when the trigger component is clicked', async () => {
|
||||
|
||||
// Click the trigger component
|
||||
const triggerButton = screen.getByText('Open Error Modal');
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
await user.click(triggerButton);
|
||||
|
||||
// Check if the modal is displayed
|
||||
@@ -165,13 +165,12 @@ it('should close the modal when the onCancel event is triggered', async () => {
|
||||
|
||||
// Click the trigger component
|
||||
const triggerButton = screen.getByText('error');
|
||||
const user = userEvent.setup();
|
||||
const user = userEvent.setup({ pointerEventsCheck: 0 });
|
||||
await user.click(triggerButton);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('An error occurred')).toBeInTheDocument();
|
||||
});
|
||||
const modal = screen.getByRole('dialog');
|
||||
|
||||
// Trigger the onCancel event
|
||||
await user.click(screen.getByTestId('close-button'));
|
||||
@@ -181,6 +180,8 @@ it('should close the modal when the onCancel event is triggered', async () => {
|
||||
|
||||
await waitFor(() => {
|
||||
// check if the modal is not visible
|
||||
expect(modal).toHaveStyle({ display: 'none' });
|
||||
const modal = document.getElementsByClassName('ant-modal');
|
||||
const style = window.getComputedStyle(modal[0]);
|
||||
expect(style.display).toBe('none');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// radio option labels — popover content inherits the root font
|
||||
// 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(--label-base-400-font-size);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Provider } from 'react-redux';
|
||||
import { act, render, renderHook } from 'tests/test-utils';
|
||||
import { act, render, renderHook } from '@testing-library/react';
|
||||
import { DEFAULT_TIME_RANGE } from 'container/TopNav/DateTimeSelectionV2/constants';
|
||||
import configureStore, { MockStoreEnhanced } from 'redux-mock-store';
|
||||
import { useGlobalTimeStore } from 'store/globalTime/globalTimeStore';
|
||||
@@ -42,13 +42,13 @@ describe('GlobalTimeStoreAdapter', () => {
|
||||
globalTime: createGlobalTimeState(),
|
||||
});
|
||||
|
||||
const { asFragment } = render(
|
||||
const { container } = render(
|
||||
<Provider store={store}>
|
||||
<GlobalTimeStoreAdapter />
|
||||
</Provider>,
|
||||
);
|
||||
|
||||
expect(asFragment().hasChildNodes()).toBe(false);
|
||||
expect(container.firstChild).toBeNull();
|
||||
});
|
||||
|
||||
it('should sync relative time from Redux to Zustand store', () => {
|
||||
|
||||