fix: add alert when clicked on create pods and podsgroup#261
Conversation
Signed-off-by: pggdev <princegupta.ns153@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces the onCreateDialogUnavailable prop to the SearchBar component, allowing for custom handling when a creation dialog is not supported. This mechanism is implemented in the PodGroups and Pods components, with the latter currently using an alert as a placeholder. Review feedback suggests improving code formatting in Searchbar.jsx, replacing the blocking alert() call with a modern non-blocking UI component like a Snackbar, and addressing potential dead code or enabling the existing creation logic in Pods.jsx.
| if(onCreateDialogUnavailable) { | ||
| onCreateDialogUnavailable(); | ||
| return ; | ||
| } |
There was a problem hiding this comment.
The formatting in this block can be improved for better consistency and adherence to standard JavaScript style guides. Specifically, add a space after the if keyword and remove the extra space before the semicolon in the return statement.
| if(onCreateDialogUnavailable) { | |
| onCreateDialogUnavailable(); | |
| return ; | |
| } | |
| if (onCreateDialogUnavailable) { | |
| onCreateDialogUnavailable(); | |
| return; | |
| } |
|
|
||
| // For now, no creation dialog | ||
| const handleCreate = () => { | ||
| alert("Create Pod is not supported yet"); |
There was a problem hiding this comment.
| dialogResourceNameLabel="Pod Name" | ||
| dialogResourceType="Pod" | ||
| onCreateClick={handleCreatePod} | ||
| onCreateDialogUnavailable={handleCreate} |
There was a problem hiding this comment.
By switching to onCreateDialogUnavailable, the handleCreatePod function (defined at line 101) is no longer used. If pod creation is intentionally being disabled, this dead code should be removed. However, since CreateDialog already supports the 'Pod' resource type, consider enabling it in Searchbar.jsx instead of using this alert fallback to allow the existing creation logic to function.
Description
#260
Added fallback feedback for create actions that do not currently have a supported dialog.
Changes
onCreateDialogUnavailablehandler to the sharedSearchBarjScreenShots