-
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
Bugfix/improve s alert message for unsuccessful attempts #3288
Bugfix/improve s alert message for unsuccessful attempts #3288
Conversation
…ding-featured-apis fixed change text
Added configuration to run 2017Q4 version of Travis Trusty env.
…-is-removed s alert added with successful message
…er-visiting-feedback-tab-of-a-public-api fixed Show text for anonymous user visiting feedback tab of a public API
Add version information of Chimp and Chromedriver to Travis logs.
…ub.com/apinf/platform into feature/generate-and-store-login-token
…ld-validate-if-is-used-by-some-api Bugfix/remove proxy settings should validate if is used by some api
…licate-error Return id of duplicate API in post api duplicate error
…token Feature/generate and store login token
21e47e6
to
3c11e54
Compare
s alerts added travis error resolved travis error resolved condition for invalid url added looping changed travis resolved travis resolved s alerts added travis error resolved travis error resolved condition for invalid url added looping changed travis resolved travis resolved s alerts added travis resolved
1e5ef71
to
a5c5167
Compare
…ts' into bugfix/improve-s-alert-message-for-unsuccessful-attempts
isValidUrl = regex.test(apiData.url); | ||
|
||
// If json does't contain name and URL | ||
if (apiData && !apiData.name && !apiData.url) { |
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.
You declared apiData
above. Boolean value of {}
returns true
. It means to not add it in the condition
if (!apiData.name && !apiData.url) {
...
}
|
||
// If json doesn't have name and valid url | ||
} else if (apiData && !apiData.name && !isValidUrl) { | ||
const isValidUrl = regex.test(apiData.url); |
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.
You declared this value above and make the same action!
// Make sure status is successful | ||
if (status.isSuccessful) { | ||
if (status) { |
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.
The redundant checking. status
variable has the default value
{
isSuccessful: false,
message: '',
};
The boolean value of Object is true
Remove it
} else if (apiData && !apiData.name && !isValidUrl) { | ||
const isValidUrl = regex.test(apiData.url); | ||
const invalidUrlAndWithoutName = TAPi18n | ||
.__('importApiConfiguration_file_with_invalid_url_withoutName'); |
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.
- Create one variable to store a message text and name it "message"
- The i18n tag has camel case format
Must be "importApiConfiguration_errorText_invalidUrl"
Remake all i18n tags that you added - Create a new variable to store value if a file has invalid format
if (invalidFileFormat) {
sAlert.error(message)
} else {
Meteor.call('importApiConfigs', apiData, .... )
}
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.
Make the sane scenario as provided in the issue
Pseudocode
- lowerCase all object keys
- If no name and no url then
invalidFileFormat = true; message = "Name & URL are requered"
- If name & no url then ...
- if url exists then
- if no name then ...
- if invalid url format then ...
- if invalid url format and name exists then ...
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.
The better solution is to create separate function that will return object with property:
- invalidFileFormat: true/false
- message: string
@krashna-deligence @saransh-dev What the status of the PR? |
Closed this PR and moved all requested changes to original PR |
@krashna-deligence @saransh-dev have made chage requests in the PR #3275. Please have a look. |
Related issue #3239
Related PR #3275
Changes
Developer checklist
This checklist is to be completed by the PR developer:
Reviewer checklist
Reviewed by: @krashna-deligence @marla-singer
This list is to be completed by the pull request reviewer: