Commit b44841b
authored
[ZEPPELIN-6214] Fix new web app to handling carriage return
### What is this PR for?
Fix an issue where the new Angular UI (zeppelin-web-angular) does not correctly handle carriage return (`\r`) characters.
This causes outputs like progress bars(`#`) or status updates that use `\r` to overwrite lines to appear ugly and unnecessarily long.
This implementation is a direct port of the previous logic from the classic UI (zeppelin-web), specifically based on the original implementation in [result.controller.js](https://github.com/apache/zeppelin/blob/8ca6e57f27324b1e74fc78bea5cabd176b607408/zeppelin-web/src/app/notebook/paragraph/result/result.controller.js#L527) and [result.js](https://github.com/apache/zeppelin/blob/8ca6e57f27324b1e74fc78bea5cabd176b607408/zeppelin-web/src/app/notebook/paragraph/result/result.js#L23).
_Additionally, this update changes the behavior of the carriage return (`\r`) character to better emulate standard terminal functionality._
Instead of clearing the entire line, the `\r` character now moves the cursor to the beginning of the line and overwrites the existing text. This "terminal-like" partial overwrite behavior is more accurate and what most interpreters expect.
This enhancement has been applied to both the classic and new UIs for consistent, standards-compliant output.
### What type of PR is it?
Bug Fix
### Todos
### What is the Jira issue?
[ZEPPELIN-6214]
### How should this be tested?
* Any zeppelin notebook paragraph that generating progress bar (`#`) is the easiest to test this change.
* Or you can reproduce the Jira Issue ticket's situation by running the code. Installing conda, set your own conda env, and set path in zeppelin is required.
* For testing terminal-like CR behavior - you can run the code like below in zeppelin notebook with shell interpreter.
```bash
printf 'Initializing system, please wait...\rLoading components...\n'
printf 'Progress: [25%%]\rProgress: [50%%]\rProgress: [100%%]\n'
```
### Screenshots (if appropriate)
* Current Version
<img width="2423" height="1021" alt="CR_Current" src="https://github.com/user-attachments/assets/e368c49d-2519-4497-ab25-f0ddfdd19a8a" />
* Fixed Version (with supporting terminal-like carriage return)
<img width="2496" height="589" alt="1_CR_new" src="https://github.com/user-attachments/assets/68a88195-1058-465b-a704-4d641ab745ac" />
### Questions:
* Does the license files need to update? N
* Is there breaking changes for older versions? N
* Does this needs documentation? N
Closes #4986 from shmruin/ZEPPELIN-6214.
Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>1 parent 890ddfe commit b44841b
2 files changed
+41
-12
lines changedLines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
254 | 278 | | |
255 | 279 | | |
256 | | - | |
| 280 | + | |
| 281 | + | |
257 | 282 | | |
258 | 283 | | |
259 | 284 | | |
| |||
Lines changed: 15 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
34 | 29 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
0 commit comments