kimyenac opened a new pull request, #5305:
URL: https://github.com/apache/zeppelin/pull/5305

   ### What is this PR for?
   The New UI note-create dialog generates note names using 
`String.prototype.substr()`, an Annex B (legacy) API the language spec 
recommends against and flags for eventual removal. This PR migrates the three 
`substr()` calls in `note-create.component.ts` to the recommended `slice()`.
   
   The two methods are not blindly interchangeable — `substr(start, length)` 
takes a length, while `slice(start, end)` takes an end index — so each call 
site was checked individually to confirm behavior is preserved:
   
   - `newNoteName()`: `substr(15)` → `slice(15)` — single-arg, runs to end of 
string (equivalent).
   - `cloneNoteName()`: `substr(0, lastIndex)` → `slice(0, lastIndex)` — 
equivalent specifically because the start is `0`, so `length` and the end index 
coincide.
   - `cloneNoteName()`: `substr(lastIndex)` → `slice(lastIndex)` — single-arg, 
runs to end of string (equivalent).
   
   Generated names for both new notes (`Untitled Note N`) and cloned notes are 
unchanged from current behavior.
   
   ### What type of PR is it?
   Improvement
   
   ### Todos
   * [x] - Replace all three `substr()` calls with `slice()`
   * [x] - Confirm no remaining `substr()` usage in the file
   
   ### What is the Jira issue?
   [ZEPPELIN-6473](https://issues.apache.org/jira/browse/ZEPPELIN-6473)
   
   ### How should this be tested?
   This repository's frontend has no unit-test infrastructure, so verification 
is via lint plus a production build:
   ```
   cd zeppelin-web-angular
   npm run lint && npm run build:angular
   ```
   Both pass. Manually confirm that creating a new note still produces 
`Untitled Note N` with a correctly incremented number, and that cloning a note 
still produces a correctly numbered copy name.
   
   ### Questions:
   * Does the license files need to update? No
   * Is there breaking changes for older versions? No
   * Does this needs documentation? No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to