Closed YogeshJayaseelan closed 4 months ago
@YogeshJayaseelan the screenshot wasn't uploaded can you upload it again?
Please assign it to me after you do
@dilippitchika Added screenshot
@vasanth-appsmith how to indicate errors like this in this component? Please take a look at the current behavior in the table widget for duplicates. I believe we could improve the error feedback here.
This is how it looks for the table widget
@dilippitchika Why is this a problem?
Extracted the below technical solution through ChatGPT. Hope this gives some direction
Technical Solutions: (ChatGPT)
Front-End Code (React):
ButtonGroup Component Update:
Update the ButtonGroup component to handle the validation logic for unique button names:import React, { useState } from 'react';
const ButtonGroup = () => { const [buttons, setButtons] = useState([{ name: 'Favorite' }, { name: 'Add' }]); const [error, setError] = useState('');
const addButton = (name) => { if (buttons.some(button => button.name === name)) { setError('Button name must be unique'); } else { setButtons([...buttons, { name }]); setError(''); } };
return (
{error}
}export default ButtonGroup;
Menu Component Update:
Update the Menu component to handle the validation logic for unique menu item names:import React, { useState } from 'react';
const Menu = () => { const [menuItems, setMenuItems] = useState([{ name: 'Item1' }, { name: 'Item2' }]); const [error, setError] = useState('');
const addMenuItem = (name) => { if (menuItems.some(item => item.name === name)) { setError('Menu item name must be unique'); } else { setMenuItems([...menuItems, { name }]); setError(''); } };
return (
{error}
}export default Menu;
CSS for Error Message:
Ensure you have appropriate styling for the error message: .error { color: red; font-size: 12px; }
Back-End Code (Spring Boot):
Controller Update:
Update the controller to handle the validation logic if any backend validation is necessary:@RestController@RequestMapping("/api/widgets")public class WidgetController {
private Set
@PostMapping("/addButton")
public ResponseEntity
@PostMapping("/addMenuItem")
public ResponseEntity
}
Hello @Nikhil-Nandagopal @dilippitchika @YogeshJayaseelan , is this issue still open. can I try to solve this issue?
@saicharan-zemoso I don't think this is a valid issue so I'm going to close it
@Nikhil-Nandagopal , Even I had the same thought that this might not be a valid issue, but the UI and logic is already in place, therefore, we internally worked on this issue and will present pull request in few days,
Request you to consider it once. So it show Red border along the duplicate menu item, or duplicate button label, only logic piece was missing which will be there in the pull request.
@saicharan-zemoso you can create the draft pr, and explain the solution
@akshayvijayjain would you be open to a quick chat next week? Here's my calendly https://calendly.com/appsmith-nikhil/30min
@akshayvijayjain would you be open to a quick chat next week? Here's my calendly https://calendly.com/appsmith-nikhil/30min
sure, booked a slot!
Is there an existing issue for this?
Current Behavior
It is observed that the button group widget accepts duplicates button and the menu button widgets also accept duplicate menu button
Steps To Reproduce
Environment
Production
Version
Cloud