Skip to content
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

Issue#616 #916

Merged
merged 50 commits into from
Mar 21, 2016
Merged

Issue#616 #916

merged 50 commits into from
Mar 21, 2016

Conversation

Alapan
Copy link
Contributor

@Alapan Alapan commented Mar 10, 2016

<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h3 class="modal-title">{{_ "apiBackends_Delete_API_Title"}}</h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename this i18n token to deleteApiBackendConfirmation_header and add corresponding translation string to en.i18n.js.

@brylie
Copy link
Contributor

brylie commented Mar 11, 2016

Try not to use session variables much. There are usually ways to do things in the local scope. E.g. template instance variables and reactive variables.

Reference

@brylie
Copy link
Contributor

brylie commented Mar 11, 2016

All i18n tokens should be unique and prefixed with the template name. We are not re-using translations, as per the guidance of @baijat.

Meteor.call('removeApiBackend', apiBackendId);

$('#confirmDelete').hide(function() {
$('#successDelete').removeClass('hide');
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using the s-alert package to display the success message. That way we don't have to manually handle showing and hiding the success dom element. S-alert is already installed in our project.

@brylie
Copy link
Contributor

brylie commented Mar 11, 2016

Overall, great work here! This is a big feature to tackle.

Please review the above suggestions, and let me know if I may be of assistance.

@Alapan
Copy link
Contributor Author

Alapan commented Mar 14, 2016

@brylie I made almost all the changes you wanted, only thing was I was not sure about how to include span class='text-danger' in a token (explained in a comment earlier).

@Alapan
Copy link
Contributor Author

Alapan commented Mar 14, 2016

@brylie Another point was with s-alert - when deleting an API from the API details page (not the manage API page), the s-alert was not appearing when the deletion was successful and the user had been returned to the API list page (catalogue). I don't know if this is related to how fast the catalogue page is loading.

@brylie
Copy link
Contributor

brylie commented Mar 14, 2016

@Alapan, the s-alert is not high priority. It won't block this code from being merged. We can just open an enhancement, after finishing this task :-)

} else if (currentRoute === 'manageApiBackends') {
Router.go('manageApiBackends');
}
sAlert.success(instance.backendName + " was successfully deleted!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this sAlert.success() call into one of the if, else if, or else blocks.

@brylie
Copy link
Contributor

brylie commented Mar 16, 2016

Try moving the sAlert call into the if ... else if .. else block. If that works great! If not lets remove it.

// based on name of current route, load suitable parent page
var currentRoute = Router.current().route.getName();

if (currentRoute === 'viewApiBackend') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rewrite this block using a switch. Using switch will improve readability and possibly reduce the probability of semantic errors, as seen below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about using switch-case earlier, but I wasn't sure what to use for the default case.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can use whatever is in your else statement. I.e. else is similar to default. Otherwise, consider just using break as the default, when no default action is desired.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now, I don't have anything for else, as I am not sure if I can set any default route. I can replace the else if with a separate if statement, though.

@Alapan
Copy link
Contributor Author

Alapan commented Mar 16, 2016

@brylie I used switch-case and moved the s-alert inside each case, but the result was the same as before. I tried Router.onAfterAction when returning to the Catalogue page. It partially worked, but then the s-alert was showing twice.

Meteor.call('deleteApiBackendOnApiUmbrella', apiUmbrellaApiId, function(error, apiUmbrellaWebResponse) {

if (apiUmbrellaWebResponse.http_status === 204) {

Copy link
Contributor

Choose a reason for hiding this comment

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

As was pointed out in review, make sure to publish the changes on API Umbrella. This is a design of API Umbrella that changes do not take effect, at the nginx level, until they are published. We have some example code you can review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brylie I wrote the code for publishing in my last commit. I hope I did it correctly. Please review.

@brylie
Copy link
Contributor

brylie commented Mar 21, 2016

@Alapan, this looks great. I went ahead and fixed the Bootstrap button group markup, so that it renders correctly. Please review and merge this PR, if everything looks good.

Alapan pushed a commit that referenced this pull request Mar 21, 2016
@Alapan Alapan merged commit fc24c78 into develop Mar 21, 2016
@Alapan
Copy link
Contributor Author

Alapan commented Mar 21, 2016

@brylie Merged.

@Alapan Alapan deleted the Issue#616 branch March 21, 2016 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants