|
|
@ -26,10 +26,12 @@ |
|
|
|
// See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
// See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
//++
|
|
|
|
//++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import HalResource from '../api-v3/hal-resources/hal-resource.service'; |
|
|
|
|
|
|
|
|
|
|
|
export class ApiWorkPackagesService { |
|
|
|
export class ApiWorkPackagesService { |
|
|
|
protected wpBaseApi; |
|
|
|
protected wpBaseApi; |
|
|
|
|
|
|
|
|
|
|
|
constructor (protected DEFAULT_PAGINATION_OPTIONS, |
|
|
|
constructor(protected DEFAULT_PAGINATION_OPTIONS, |
|
|
|
protected $stateParams, |
|
|
|
protected $stateParams, |
|
|
|
protected $q:ng.IQService, |
|
|
|
protected $q:ng.IQService, |
|
|
|
protected apiV3:restangular.IService) { |
|
|
|
protected apiV3:restangular.IService) { |
|
|
@ -41,10 +43,7 @@ export class ApiWorkPackagesService { |
|
|
|
var workPackages = this.wpApiPath(query.projectId); |
|
|
|
var workPackages = this.wpApiPath(query.projectId); |
|
|
|
|
|
|
|
|
|
|
|
return workPackages.getList( |
|
|
|
return workPackages.getList( |
|
|
|
this.queryAsV3Params(offset, pageSize, query), |
|
|
|
this.queryAsV3Params(offset, pageSize, query), {caching: {enabled: false}} |
|
|
|
{ |
|
|
|
|
|
|
|
caching: { enabled : false } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -53,23 +52,25 @@ export class ApiWorkPackagesService { |
|
|
|
* |
|
|
|
* |
|
|
|
* @returns An empty work package form resource. |
|
|
|
* @returns An empty work package form resource. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public emptyCreateForm(projectIdentifier?:string):ng.IPromise<op.HalResource> { |
|
|
|
public emptyCreateForm(projectIdentifier?:string):ng.IPromise<HalResource> { |
|
|
|
return this.wpApiPath(projectIdentifier).one('form').customPOST(); |
|
|
|
return this.wpApiPath(projectIdentifier).one('form').customPOST(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Returns a promise to GET `/api/v3/work_packages/available_projects`. |
|
|
|
* Returns a promise to GET `/api/v3/work_packages/available_projects`. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public availableProjects(projectIdentifier?:string):ng.IPromise<op.HalResource> { |
|
|
|
public availableProjects(projectIdentifier?:string):ng.IPromise<HalResource> { |
|
|
|
return this.wpApiPath(projectIdentifier).one('available_projects').get(); |
|
|
|
return this.wpApiPath(projectIdentifier).one('available_projects').get(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public wpApiPath(projectIdentifier?: any) { |
|
|
|
public wpApiPath(projectIdentifier?:any) { |
|
|
|
|
|
|
|
const args = ['work_packages']; |
|
|
|
|
|
|
|
|
|
|
|
if (!!projectIdentifier) { |
|
|
|
if (!!projectIdentifier) { |
|
|
|
return this.apiV3.service('work_packages', this.apiV3.one('projects', projectIdentifier)); |
|
|
|
args.push(this.apiV3.one('projects', projectIdentifier)); |
|
|
|
} else { |
|
|
|
|
|
|
|
return this.apiV3.service('work_packages'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return this.apiV3.service(...args); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected queryAsV3Params(offset:number, pageSize:number, query:api.ex.Query) { |
|
|
|
protected queryAsV3Params(offset:number, pageSize:number, query:api.ex.Query) { |
|
|
|