mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
### **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> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+13/-9</a> </td> </tr> <tr> <td><strong>validateAlerts.spec.ts</strong><dd><code>Point validation tests to new module path</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-8ba923d1b6e78fb3134f2775e51fce66e5171bcfb001fcac4837639313c55b4a">+1/-1</a> </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> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-7db039e3a78f8c5306c84382f42b071f680cf4f18f84d17cedcc8d484a8b113f">+116/-0</a> </td> </tr> <tr> <td><strong>alertPayload.ts</strong><dd><code>New payload build and save alert helpers</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-914546afcdb9f9604ad6efe448d8b373fa3f24be1ba7cbc75bd18bf8c419ab3c">+211/-0</a> </td> </tr> <tr> <td><strong>alertQueryBuilder.ts</strong><dd><code>New SQL and WHERE clause builder utilities</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-5c829ce5fd3ad2f5ef359df5976e6adfc52eaa6b5f249f594c8b8a588acf8b3e">+204/-0</a> </td> </tr> <tr> <td><strong>alertSqlUtils.ts</strong><dd><code>New SQL parser wrapper for column checks</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-fea836214c2a77154fb97a519b6fa4bd0315acbffb9b3d7d94738bf073d5eabd">+33/-0</a> </td> </tr> <tr> <td><strong>alertValidation.ts</strong><dd><code>Consolidated alert validation and JSON save flow</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-3164a4a58c1865cfcbbba084ac339664c99564545be4d57504dd406d59d8ad4a">+649/-0</a> </td> </tr> <tr> <td><strong>AddAlert.vue</strong><dd><code>Refactor to use new alert utils modules</code> </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> </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> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/8611/files#diff-31dfccb7ecf243d062992787997f3e29b26579144def6a562e7f138cf3a73ed6">+0/-313</a> </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___