@ -26,7 +26,7 @@
// See doc/COPYRIGHT.rdoc for more details.
//++
function QueryConstructorService ( Filter , Sortation , UrlParamsHelper , INITIALLY _SELECTED _COLUMNS ) {
function QueryConstructorService ( Filter , Sortation , UrlParamsHelper , PathHelper , INITIALLY _SELECTED _COLUMNS ) {
var Query = function ( queryData , options ) {
angular . extend ( this , queryData , options ) ;
@ -202,6 +202,37 @@ function QueryConstructorService(Filter, Sortation, UrlParamsHelper, INITIALLY_S
this . columns = columns ;
} ,
applyDefaultsFromFilters : function ( workPackage ) {
angular . forEach ( this . filters , function ( filter ) {
// Ignore any filters except =
if ( filter . operator !== '=' ) {
return ;
}
// Select the first value
var value = filter . values ;
if ( Array . isArray ( filter . values ) ) {
value = filter . values [ 0 ] ;
}
// Avoid empty values
if ( ! value ) {
return ;
}
switch ( filter . name ) {
case 'type' :
workPackage . setAllowedValueFor ( 'type' , PathHelper . apiV3TypePath ( value ) ) ;
break ;
case 'assignee' :
workPackage . setAllowedValueFor ( 'assignee' , PathHelper . apiV3UserPath ( value ) ) ;
break ;
}
} ) ;
} ,
/ * *
* @ name isDefault
* @ function