Skip to content

fix: add alert when clicked on create pods and podsgroup#261

Open
pggdev wants to merge 1 commit into
volcano-sh:mainfrom
pggdev:fix/create-pod-and-podGroup-button
Open

fix: add alert when clicked on create pods and podsgroup#261
pggdev wants to merge 1 commit into
volcano-sh:mainfrom
pggdev:fix/create-pod-and-podGroup-button

Conversation

@pggdev
Copy link
Copy Markdown

@pggdev pggdev commented May 17, 2026

Description

#260

Added fallback feedback for create actions that do not currently have a supported dialog.

Changes

  • Added an optional onCreateDialogUnavailable handler to the shared SearchBar
  • Updated Pods and PodGroups pages to show a clear message when create is unavailable
  • Kept existing Job and Queue create dialog behavior unchanged

jScreenShots

image image

Signed-off-by: pggdev <princegupta.ns153@gmail.com>
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jessestutler for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +37 to +40
if(onCreateDialogUnavailable) {
onCreateDialogUnavailable();
return ;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
if(onCreateDialogUnavailable) {
onCreateDialogUnavailable();
return ;
}
if (onCreateDialogUnavailable) {
onCreateDialogUnavailable();
return;
}


// For now, no creation dialog
const handleCreate = () => {
alert("Create Pod is not supported yet");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using window.alert() is generally discouraged in modern React applications as it is a blocking UI element and inconsistent with the rest of the application's design. Consider using a non-blocking feedback mechanism like a Snackbar or a Toast component from Material UI.

dialogResourceNameLabel="Pod Name"
dialogResourceType="Pod"
onCreateClick={handleCreatePod}
onCreateDialogUnavailable={handleCreate}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants