### **User description**
This PR adds the missing field for promql condiiton so user will have
one input to specify when it should trigger the alert
___
### **PR Type**
Enhancement, Tests
___
### **Description**
- Add PromQL trigger condition field to alert settings UI
- Initialize and clear `promql_condition` in AddAlert component
- Include `promql_condition` in payload and panel-loading logic
- Add comprehensive unit tests for PromQL condition handling
___
### Diagram Walkthrough
```mermaid
flowchart LR
UI["AlertSettings.vue: promql_condition input"]
WATCH["AddAlert.vue: watch query type"]
PAYLOAD["AddAlert.vue: getAlertPayload updates"]
TESTS["AddAlert.spec.ts: PromQL tests"]
UI -- "user selects PromQL" --> WATCH
WATCH -- "init/clear promql_condition" --> PAYLOAD
PAYLOAD -- "include/clear fields" --> TESTS
```
<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><table>
<tr>
<td>
<details>
<summary><strong>AddAlert.spec.ts</strong><dd><code>Add PromQL condition
unit tests</code>
</dd></summary>
<hr>
web/src/components/alerts/AddAlert.spec.ts
<ul><li>Added new test suite "PromQL Condition Handling"<br> <li> Tests
for initialization on tab switch and panel load<br> <li> Tests for
preserving, clearing, and payload inclusion<br> <li> Assert
operator/value mapping for above/below</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9970/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+252/-0</a>
</td>
</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>AddAlert.vue</strong><dd><code>Initialize and handle
promql_condition</code>
</dd></summary>
<hr>
web/src/components/alerts/AddAlert.vue
<ul><li>Watcher initializes <code>promql_condition</code> on type
change<br> <li> Load panel data logic sets default condition fields<br>
<li> Payload builder clears SQL/conditions for PromQL<br> <li> Emit
<code>promqlCondition</code> update from UI component</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9970/files#diff-7b426bb23e9ed0250c3877d6d97b099c42b2d20e22ddf4459915381b2233a0a8">+10/-0</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>AlertSettings.vue</strong><dd><code>Add PromQL
condition input and validation</code>
</dd></summary>
<hr>
web/src/components/alerts/steps/AlertSettings.vue
<ul><li>Insert PromQL operator/value input row in settings<br> <li> Add
<code>update:promqlCondition</code> emit hook<br> <li> Validate
<code>promql_condition</code> in form submission<br> <li> Adjust
threshold templates for query types</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9970/files#diff-1d5bfd6a1ea672884193649b1271d751d6f3b8ec84af759071c9bfd169a8ab28">+111/-7</a>
</td>
</tr>
</table></td></tr></tr></tbody></table>
</details>
___
web
This template should help get you started developing with Vue 3 in Vite.
Recommended IDE Setup
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:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensionsfrom VSCode's command palette - Find
TypeScript and JavaScript Language Features, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Windowfrom 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