appium/appium-inspector

feature request: Duplicate Saved capability sets name

Dor-bl opened this issue · 3 comments

Current Behavior

Currently when saving caps set with same name no message is shown
image

Suggested Solution

I believe we should avoid having the same capability set names

Additional Information

No response

@eglitise I looked into it yesterday but not used to React and antd.
So finding duplicate name and throw Error in async saveSession is pretty easy, but Modal is still closed. Any suggestions on how to report this error, inside form, live disabling OK button, or onOK click but with error dialog and not closing the Modal, ... ?

@ath0mas thank you for trying to help out 🙏
I would go for the approach that shows an error message inside the modal, by modifying the onOk handler (onSaveAsOk in CapabilityEditor). My suggestion would be to grab the savedSessions value from props, compare the saved names against saveAsText, and then save the result boolean in some local variable. Finally add an antd Alert whose visibility then depends on this boolean (you can check how this is used in e.g. the Session component file with isAttaching).
Although, this would only cover the new saved session case, but not the renaming of an existing session... not sure about that one yet.

@eglitise i have created a PR with the changes. Looking forward for your review.