Merge pull request #3182 from jlmitch5/fixSearchDefaults

fix search defaults for lists
This commit is contained in:
jlmitch5 2016-08-09 13:53:06 -04:00 committed by GitHub
commit ea024c7e11
5 changed files with 14 additions and 3 deletions

View File

@ -48,6 +48,7 @@ export default
columnClass: 'col-lg-2 col-md-3 col-sm-4 col-xs-6',
ngClick: "viewJobDetails(all_job)",
defaultSearchField: true,
searchDefault: true,
},
type: {
label: 'Type',

View File

@ -22,7 +22,8 @@ export default
key: true,
label: 'Name',
columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8',
linkTo: '/#/job_templates/{{job_template.id}}'
linkTo: '/#/job_templates/{{job_template.id}}',
searchDefault: true
},
description: {
label: 'Description',

View File

@ -35,7 +35,8 @@ export default
label: 'Name',
columnClass: 'col-lg-4 col-md-4 col-sm-4 col-xs-6 List-staticColumnAdjacent',
defaultSearchField: true,
linkTo: '/#/jobs/{{job.id}}'
linkTo: '/#/jobs/{{job.id}}',
searchDefault: true
},
finished: {
label: 'Finished',

View File

@ -37,6 +37,7 @@ export default
},
name: {
key: true,
searchDefault: true,
label: 'Name',
columnClass: "col-lg-4 col-md-4 col-sm-5 col-xs-7 List-staticColumnAdjacent",
modalColumnClass: 'col-md-8'

View File

@ -34,6 +34,10 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
type = 'text';
}
if (field.searchDefault) {
obj.default = true;
}
obj.id = id;
obj.value = value;
obj.label = label;
@ -76,10 +80,13 @@ export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', '$log', fu
passThrough = partitionedOptions[1];
var joinOptions = function() {
return _.sortBy(_
var options = _.sortBy(_
.flatten([needsRequest, passThrough]), function(opt) {
return opt.id;
});
// put default first
return _.flatten(_.partition(options, opt => opt.default));
};
if (needsRequest.length) {