-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable proxy button when proxy is added #1604
Conversation
TODO: add help text to disabled button |
@frenchbread Why not hide the button instead of disabling? |
@bajiat IMHO Hiding the "Add proxy" can confuse users. I have no idea where, in that case, to put a message saying e.g. "You have already added one proxy. Can't add more for now." Disabling the button was also suggested by @Nazarah here. What's left is attaching a tooltip with helper text to a button. Open to suggestions. |
}); | ||
|
||
Template.proxies.helpers({ | ||
proxies () { | ||
const instance = Template.instance(); | ||
return instance.proxies.get(); | ||
} | ||
}, | ||
biggerThan (a, b) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use more meaningful name variables here, didn't quite get what is a and what is b.
Also comment will help.
# Conflicts: # core/lib/i18n/en.i18n.json
@@ -273,6 +273,7 @@ | |||
"proxies_pageHeader": "Proxies", | |||
"proxies_addProxy": "Add proxy", | |||
"proxies_noProxiesFound": "No proxies found.", | |||
"proxies_cannotAddMoreProxies": "You already have a Proxy available to attach your API. Please select the Proxy. You can add a new Proxy only after your have deleted the existing one.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This help text is unnecessary, if we simply hide the Add Proxy button.
const proxiesCount = Proxies.find().count(); | ||
|
||
// Set button disabled if at least one proxy is already added | ||
instance.isDisabled.set(proxiesCount >= 1); | ||
} | ||
}); | ||
}); | ||
|
||
Template.proxies.events({ | ||
'click #add-proxy': function (event, instance) { | ||
Modal.show('addProxy', { proxy: {}, isEdit: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be aware of changes to the addProxy
form. Specifically, the template has been renamed proxyForm
and used for both adding and editing proxies.
This is really close. Just clean up the help text, which is not necessary. Also, check linter errors for missing imports, etc. |
# Conflicts: # proxies/client/proxies.html # proxies/client/proxies.js
Changes are done |
Closes #1484