Files
openobserve/web
Sai Nikhil 980949392a fix: alert module code splitting (#8611)
### **User description**
add alert module splitting into util files


___

### **PR Type**
Enhancement, Tests


___

### **Description**
- Extract alert logic into utils modules

- Refactor AddAlert to use utilities

- Add SQL/where/query builder helpers

- Update tests to new utilities


___

### Diagram Walkthrough


```mermaid
flowchart LR
  AddAlertVue["AddAlert.vue (component)"] -- uses --> alertQueryBuilder["utils/alerts/alertQueryBuilder.ts"]
  AddAlertVue -- uses --> alertPayload["utils/alerts/alertPayload.ts"]
  AddAlertVue -- uses --> alertValidation["utils/alerts/alertValidation.ts"]
  AddAlertVue -- uses --> alertDataTransforms["utils/alerts/alertDataTransforms.ts"]
  AddAlertVue -- uses --> alertSqlUtils["utils/alerts/alertSqlUtils.ts"]
  AddAlertSpec["AddAlert.spec.ts"] -- import --> alertQueryBuilder
  validateAlertsSpec["utils/validateAlerts.spec.ts"] -- import --> alertValidation
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>2
files</summary><table>
<tr>
<td><strong>AddAlert.spec.ts</strong><dd><code>Tests use extracted
generateWhereClause utility</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+13/-9</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>validateAlerts.spec.ts</strong><dd><code>Point validation
tests to new module path</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-8ba923d1b6e78fb3134f2775e51fce66e5171bcfb001fcac4837639313c55b4a">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>7
files</summary><table>
<tr>
<td><strong>alertDataTransforms.ts</strong><dd><code>New FE/BE condition
transform and group ops</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-7db039e3a78f8c5306c84382f42b071f680cf4f18f84d17cedcc8d484a8b113f">+116/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertPayload.ts</strong><dd><code>New payload build and save
alert helpers</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-914546afcdb9f9604ad6efe448d8b373fa3f24be1ba7cbc75bd18bf8c419ab3c">+211/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertQueryBuilder.ts</strong><dd><code>New SQL and WHERE
clause builder utilities</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-5c829ce5fd3ad2f5ef359df5976e6adfc52eaa6b5f249f594c8b8a588acf8b3e">+204/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertSqlUtils.ts</strong><dd><code>New SQL parser wrapper
for column checks</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-fea836214c2a77154fb97a519b6fa4bd0315acbffb9b3d7d94738bf073d5eabd">+33/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>alertValidation.ts</strong><dd><code>Consolidated alert
validation and JSON save flow</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-3164a4a58c1865cfcbbba084ac339664c99564545be4d57504dd406d59d8ad4a">+649/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>AddAlert.vue</strong><dd><code>Refactor to use new alert
utils modules</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-7b426bb23e9ed0250c3877d6d97b099c42b2d20e22ddf4459915381b2233a0a8">+110/-681</a></td>

</tr>

<tr>
<td><strong>ScheduledAlert.vue</strong><dd><code>UI tweaks and cleanup
of unused logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-5e143a17ab0fa5d7817f6d9301667fb5597236f27184248c7a71728e85b8d999">+22/-165</a></td>

</tr>

</table></details></td></tr><tr><td><strong>Miscellaneous</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>validateAlerts.ts</strong><dd><code>Remove legacy validation
(replaced by utils)</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8611/files#diff-31dfccb7ecf243d062992787997f3e29b26579144def6a562e7f138cf3a73ed6">+0/-313</a>&nbsp;
</td>

</tr>
</table></details></td></tr></tr></tbody></table>

</details>

___
2025-09-24 13:48:05 +05:30
..
2023-02-02 09:03:11 +05:30
2023-08-06 01:29:13 +08:00
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2024-04-03 12:49:25 +05:30
2023-02-02 09:03:11 +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