[NAE-2394] - Fields looks editable when switching tabs#318
[NAE-2394] - Fields looks editable when switching tabs#318Kovy95 merged 1 commit intorelease/6.4.2from
Conversation
- fix problem with fields while switching the tabs, add block fields to get data event
WalkthroughThree component files have been updated to inject a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.spec.ts`:
- Around line 219-226: Add a regression spec that injects NAE_TAB_DATA with an
injectedTabData mock exposing tabSelected$ (Subject) and wires the component
under test using the existing constructor/super setup; emit a tabSelected$ event
in the test, stub the GET_DATA response path (the post-GET_DATA callback) to
return task data with blocked fields and set the task editable flag, then assert
the blocked fields remain when _userComparator (UserComparatorService) and
finish permission (finishPolicyService/finishPolicy) indicate success, and
assert the callback forces blocks when _userComparator or finish permission
fails; use spies/mocks on _taskDataService GET/subscribe and on
_userComparator.compare and finishPolicyService.canFinish to drive both success
and failure cases and verify the component’s blocked-field state after the
tabSelected$ emission.
In
`@projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts`:
- Around line 148-151: The constructor change in AbstractTaskPanelComponent
added a required _userComparator parameter before existing optional parameters,
breaking positional super(...) calls; restore source-compatibility by moving the
new UserComparatorService parameter to after the existing tail (after
injectedTabData) or obtain the comparator internally (e.g., via injector) so the
public constructor signature (the order of overflowService, _taskForceOpen,
injectedTabData) remains unchanged; update the constructor signature and any use
of _userComparator inside the class accordingly while keeping the original
parameter order for downstream subclasses.
- Around line 200-205: The callback passed to initializeTaskDataFields currently
computes taskShouldBeBlocked and calls
_taskContentService.blockFields(taskShouldBeBlocked), which wipes per-field
block flags; instead, change the logic so you only call
_taskContentService.blockFields(true) when the predicate is true (i.e., task is
missing or user undefined or !_userComparator.compareUsers(...) OR
hasNoFinishPermission()), and do nothing in the false/editable branch so
existing per-field block state from GET_DATA is preserved; update the predicate
to include hasNoFinishPermission() and only invoke blockFields when that
combined predicate is true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 73424906-33e4-4999-9848-8ee5fcc4078d
📒 Files selected for processing (3)
projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.spec.tsprojects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.tsprojects/netgrif-components/src/lib/panel/task-panel/task-panel.component.ts
projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.spec.ts
Show resolved
Hide resolved
projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts
Show resolved
Hide resolved
projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts
Show resolved
Hide resolved
|



Description
Fixes NAE-2394
Dependencies
none
Third party dependencies
Blocking Pull requests
There are no dependencies on other PR
How Has Been This Tested?
manually
Test Configuration
<Please describe configuration for tests to run if applicable, like program parameters, host OS, VM configuration etc. You can use >
Checklist:
Summary by CodeRabbit