feat(Dashboard2/Navigation): add path navigation [YTFRONT-5216]#1314
feat(Dashboard2/Navigation): add path navigation [YTFRONT-5216]#1314KostyaAvtushko wants to merge 6 commits intomainfrom
Conversation
Reviewer's GuideThis PR introduces direct path navigation to the Dashboard2 navigation widget by embedding a PathEditor with a confirm button, wiring up URL updates via react-router, auto-selecting input on focus, enriching item icon logic with node attributes, and exposing a toggle setting, along with supporting API and styling adjustments. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Storybook is ready. |
|
Playwright components report is ready. |
|
Statoscope report is ready. |
|
No test reports are available for this run. |
51c20c2 to
a08e64c
Compare
0c9a1f4 to
8a1ef5c
Compare
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- Extract the path normalization (trailing slash trimming) into a shared utility (e.g. normalizePath) to improve readability and avoid duplication.
- Use URLSearchParams (or similar) instead of manual string concatenation to build the navigation URL, ensuring correct encoding of query parameters.
- Move the inline Button style (
height: '100%') into a SCSS class rather than using inline styles to keep styling consistent and maintainable.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Extract the path normalization (trailing slash trimming) into a shared utility (e.g. normalizePath) to improve readability and avoid duplication.
- Use URLSearchParams (or similar) instead of manual string concatenation to build the navigation URL, ensuring correct encoding of query parameters.
- Move the inline Button style (`height: '100%'`) into a SCSS class rather than using inline styles to keep styling consistent and maintainable.
## Individual Comments
### Comment 1
<location> `packages/ui/src/ui/containers/PathEditor/PathEditor.tsx:312-319` </location>
<code_context>
}
};
- renderInput() {
+ renderBaseInput() {
const {placeholder, autoFocus, hasClear, disabled} = this.props;
</code_context>
<issue_to_address>
**suggestion:** Consider keyboard accessibility for the confirm button.
Support triggering the onApply action via keyboard events, such as the Enter key, when hasConfirmButton is true.
Suggested implementation:
```typescript
handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
const {hasConfirmButton, onApply} = this.props;
const {path} = this.state;
if (hasConfirmButton && event.key === 'Enter' && typeof onApply === 'function') {
onApply(path);
}
};
renderInput() {
const {hasConfirmButton, onApply} = this.props;
const {path} = this.state;
if (!hasConfirmButton) {
```
```typescript
renderBaseInput() {
const {placeholder, autoFocus, hasClear, disabled, hasConfirmButton} = this.props;
const {path} = this.state;
return (
<input
type="text"
value={path}
placeholder={placeholder}
autoFocus={autoFocus}
disabled={disabled}
onChange={this.handleInputChange}
onKeyDown={hasConfirmButton ? this.handleInputKeyDown : undefined}
/>
);
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| ); | ||
| } | ||
|
|
||
| renderInput() { | ||
| const {hasConfirmButton, onApply} = this.props; | ||
| const {path} = this.state; | ||
|
|
||
| if (!hasConfirmButton) { |
There was a problem hiding this comment.
suggestion: Consider keyboard accessibility for the confirm button.
Support triggering the onApply action via keyboard events, such as the Enter key, when hasConfirmButton is true.
Suggested implementation:
handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
const {hasConfirmButton, onApply} = this.props;
const {path} = this.state;
if (hasConfirmButton && event.key === 'Enter' && typeof onApply === 'function') {
onApply(path);
}
};
renderInput() {
const {hasConfirmButton, onApply} = this.props;
const {path} = this.state;
if (!hasConfirmButton) { renderBaseInput() {
const {placeholder, autoFocus, hasClear, disabled, hasConfirmButton} = this.props;
const {path} = this.state;
return (
<input
type="text"
value={path}
placeholder={placeholder}
autoFocus={autoFocus}
disabled={disabled}
onChange={this.handleInputChange}
onKeyDown={hasConfirmButton ? this.handleInputKeyDown : undefined}
/>
);
}8a1ef5c to
7ebcf04
Compare
|
Some CI actions are failed |
https://nda.ya.ru/t/SMdmjkxC7KLvxg
## Summary by SourceryAdd manual path navigation to the Dashboard2 Navigation widget by integrating a PathEditor input with a confirm button, toggled via a new widget setting, and refactor related API requests to support node icon attributes.
New Features:
Enhancements: