Files
openobserve/web
Ashish Kolhe 44221da314 feat(alerts): contextual help side panels for Additional Settings (#12922)
## What

Adds a contextual **help side panel** to the alert **Additional
Settings** tab. Each control (Template Override, Additional Variables,
Row Template) gets a **"Learn more"** link that opens a right-side
`ODrawer` explaining the control and showing a live, honest preview of
the notification message.

## Why

The old one-line tooltips didn't tell users what was actually changing —
e.g. Template Override just listed templates without showing the current
vs. selected message. This panel teaches first-time users *what* each
control does, *why* they'd use it, and shows *what gets sent*.

## Highlights

- **`useTemplatePreview` composable** — display-only `{variable}`
substitution: live form values shown as "your data", mock runtime values
marked as samples, and context-sensitive tokens (`{rows}`, `{rows:N}`,
`{var:N}`, `{...rows}`) rendered as opaque "filled at notification time"
chips — never faked against the real server renderer.
- **Template Override** — shows each destination's current message vs. a
non-destructive template preview (Apply required to commit).
- **Additional Variables** — plain-language explanation, a before/after
"why use a variable", a worked example with rendered result, and a
collapsible built-in-variable reference (not an 18-chip wall). Removed a
phantom variable (`{alert_agg_value}`) the UI advertised but the backend
never substitutes; added the real `{alert_description}`.
- **Row Template** — explains how `row_template` + `{rows}` compose,
with a worked example.
- **Reordered** the Advanced tab: Additional Settings → Compare with
Past → Deduplication.
- **Editor scroll fix** — Monaco editors now release the mouse wheel to
the page once their own content has nothing left to scroll (was trapping
page scroll on hover). App-wide default via an opt-out prop on the
shared `CodeQueryEditor`.

## Implementation notes

- Styling uses the `.css` design-token layer (`--color-*`,
`--radius-*`), theme-aware (light/dark); reuses
`OBadge`/`ODrawer`/`OSelect` rather than hand-rolling. No `px` (except
1/2px borders), no inline styles, no hardcoded colors.
- Every section has an empty state — no blank preview boxes.
- i18n `{...}` braces escaped for vue-i18n so literal placeholders
render.

## Tests

- Unit: `useTemplatePreview` (token classification, live/mock/opaque,
context vars, stream fields stay opaque).
- Component: `AlertSettingsHelpDrawer` (per-topic content, current vs.
preview, collapsible built-ins, empty states, i18n-literal & phantom-var
regression guards).
- Wiring: `Advanced.spec.ts` (Learn-more triggers); editor:
`CodeQueryEditor.spec.ts` (scroll prop).
- E2E (Playwright): `alerts-help-drawer.spec.js` smoke — open drawer,
no-mutation-until-Apply, overlay close, collapsible built-ins. (Not
executed in this environment — no backend/creds.)

228 unit/component tests pass locally.

## Notes for reviewer

- Draft: please review the description and the UX copy.
- The Monaco scroll default change touches the shared `CodeQueryEditor`
(used app-wide); behavior is opt-out via
`:release-wheel-to-page="false"` if any full-page editor should own the
wheel.
2026-06-29 12:15:05 +00:00
..
2025-12-04 13:58:09 +05:30
2026-05-28 11:00:49 +00:00
…
…
2024-04-03 12:49:25 +05:30

web

This template should help get you started developing with Vue 3 in Vite.

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

For stand-alone UI development environment, create .env file and which contains below environment variable

VITE_OPENOBSERVE_ENDPOINT=http://localhost:5080/
npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Cypress

npm run test:e2e:dev

This runs the end-to-end tests against the Vite development server. It is much faster than the production build.

But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):

npm run build
npm run test:e2e

Lint with ESLint

npm run lint