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
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', columnClass: 'col-lg-2 col-md-3 col-sm-4 col-xs-6',
ngClick: "viewJobDetails(all_job)", ngClick: "viewJobDetails(all_job)",
defaultSearchField: true, defaultSearchField: true,
searchDefault: true,
}, },
type: { type: {
label: 'Type', label: 'Type',

View File

@@ -22,7 +22,8 @@ export default
key: true, key: true,
label: 'Name', label: 'Name',
columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8', 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: { description: {
label: 'Description', label: 'Description',

View File

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

View File

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

View File

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