-
Notifications
You must be signed in to change notification settings - Fork 105
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
Project client #70
Project client #70
Conversation
var service = this; | ||
|
||
service.create = create; | ||
service.read = read; | ||
service.update = update; | ||
service.delete = del; | ||
service.del = del; | ||
service.readComplete = readComplete; |
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 can use the $http service to set querystrings for you via a configuration object. Here is the relevant documenation.
Instead of creating a whole new method, you should just use service.read
! Something like this:
function read(id, params) {
var url = (id) ? '/projects/' + id : '/projects';
return $http.get(url, { params : params });
}
// in your controller
ProjectService.read(null, { complete : 1 })
.then(function (projects) {
console.log('The complete projects:', projects);
});
AngularJS should automatically serialize the parameters into a query string for you.
@lomamech, I've completed an initial review. Somethings to remember:
Thank you for using the "@jniles" syntax. Let me know when you've look into these errors. |
@jniles I'm looking at thes errors and I start simultaneously correction |
@jniles @DedrickEnc I just correct errors but also to make improvements, |
@lomamech, this is good to see. Your integration tests do not pass. Here are your results. I'll review the code when the tests pass. |
var service = this; | ||
|
||
service.create = create; | ||
service.read = read; | ||
service.update = update; | ||
service.delete = del; | ||
service.del = del; |
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.
Why did you change this?
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.
@jniles just to not have a big difference with the other function
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.
That's a good intention, but the reason we cannot call the function "delete" is because delete
is a javascript reserved word. To make the API clear, the API should still be called service.delete
.
SnisService.$inject = ['$http', 'util']; | ||
|
||
function SnisService($http, util) { | ||
var service = {}; |
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.
var service = this
.
@lomamech, the end to end tests pass for me on master, but do not pass on your branch. I've uploaded your results. Please, please, run end to end tests and integration tests before submitting a PR. |
@jniles end to end tests and integration tests run very well |
@jniles 6 test end to end had fails because the data format sended by ProjectService |
<button class="btn btn-sm btn-default" id="create" ng-click="ProjectCtrl.create()" data-method="create"> | ||
<span class="glyphicon glyphicon-plus-sign"></span> {{ 'PROJECT.NEW' | translate }} | ||
</button> | ||
</div> | ||
|
||
<div class="report visible-print"> |
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 can delete this entire section (<div class="report visible-print>"
) - it is no longer used and is bad practice. It also slows down the loading of the module.
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 is still not fixed. Please delete this entire <div>
.
<div class="form-group"> | ||
<label class="col-md-3 control-label">{{ 'COLUMNS.LOCKED' | translate }}</label> | ||
<div class="col-md-9"> | ||
<input type="checkbox" id="locked" ng-true-value="1" ng-false-value="0" name="bhima-project-locked" ng-model="ProjectCtrl.project.locked"> |
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 proper way to make a bootstrap checkbox input is to use the "checkbox" class. Here is the documentation. You should be using the "checkbox" class on a <div>
and wrapping the <label>
element around the checkbox.
@lomamech, these are very nice tests. I'm glad that the ProjectService API change was caught, that could have been a painful bug in the future. I've made some comments, mostly on HTML and CSS style. Since we are now using bootstrap rules for styling, it is important that we abide by bootstrap standards. There is also a whole section that can be deleted - it was useful before we learned how to create PDF reports. There is one test to add based on a bug that I found in the $window.confirm() alert box. That bug should be fixed before this PR can be merged. Overall, this code and PR is looking very good. Once it is bug free and up to standards, it will be a valuable contribution. |
…process of a project
@jniles did you analyze the latest changes |
You must let me know when to analyze changes again by leaving a comment. Otherwise, I do not know if you will add more or not. You have one more change to make, then this can be merged in, assuming it passes tests. There's a lot of unused HTML that should be deleted. |
@jniles I just did it |
LGTM. |
This commit implements meaningful, translated server error messages. This should help a user know what went wrong with a little bit more accuracy. Closes Third-Culture-Software#70. Closes Third-Culture-Software#97.
Updated part client of unit project and adding the test end to end
@jniles @DedrickEnc