### **PR Type**
Bug fix, Enhancement
___
### **Description**
- Replace regex-based operator spacing with util
- Add state-based `addSpacesToOperators` function
- Update composables and component imports
- Prevent catastrophic regex backtracking
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["Raw whereClause"] -- "addSpacesToOperators" --> B["Spaced whereClause"]
B -- "used in" --> C["IndexList.vue / useLogs / useQuery"]
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>IndexList.vue</strong><dd><code>Replace regex spacing
with util call</code>
</dd></summary>
<hr>
web/src/plugins/logs/IndexList.vue
<ul><li>Imported <code>addSpacesToOperators</code> util<br> <li> Removed
inline regex-based spacing<br> <li> Replaced with
<code>addSpacesToOperators(whereClause)</code></ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7653/files#diff-08f058f883b659e713e606991a7ea37ae1ff016b7cccef970489ab5840dc3d09">+2/-10</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>useLogs.ts</strong><dd><code>Use util for query
operator spacing</code>
</dd></summary>
<hr>
web/src/composables/useLogs.ts
<ul><li>Added <code>addSpacesToOperators</code> import<br> <li> Removed
chained <code>.replace</code> regex calls<br> <li> Applied
<code>addSpacesToOperators</code> for whereClause</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7653/files#diff-1040f61354f92711e0e77ed4e9bfa15586d45a94c7e2ab06cc37372068030e7b">+4/-11</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>useQuery.ts</strong><dd><code>Replace regex in useQuery
with util</code>
</dd></summary>
<hr>
web/src/composables/useQuery.ts
<ul><li>Imported <code>addSpacesToOperators</code><br> <li> Removed
manual regex replacements<br> <li> Called
<code>addSpacesToOperators(whereClause)</code></ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7653/files#diff-fe0bf52b216893c6a31f2923aab979e0d817c742b0cfd75e524e60db75b1d3e8">+4/-11</a>
</td>
</tr>
<tr>
<td>
<details>
<summary><strong>zincutils.ts</strong><dd><code>Implement
addSpacesToOperators utility</code>
</dd></summary>
<hr>
web/src/utils/zincutils.ts
<ul><li>Added <code>addSpacesToOperators</code> function<br> <li>
Implements state-based spacing logic<br> <li> Handles quotes,
parentheses, two-char operators<br> <li> Avoids exponential regex
backtracking</ul>
</details>
</td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7653/files#diff-d3d59688cccdcc6c84ebe88b698c6910030abecc3125f4c0ef81b0df023699ba">+98/-0</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