fixes to tag search ui implementation

This commit is contained in:
John Mitchell
2016-04-06 15:38:48 -04:00
parent 36a1efe4ea
commit 967194a3f3
5 changed files with 17 additions and 7 deletions

View File

@@ -79,6 +79,7 @@ export default
related: {
scan_job_templates: {
basePath: 'inventories/:id/scan_job_templates',
type: 'collection',
title: 'Scan Job Templates',
iterator: 'scan_job_template',

View File

@@ -73,7 +73,7 @@ export default
},
last_update_failed: {
label: 'Update failed?',
searchType: 'select',
searchType: 'boolean',
searchSingleValue: true,
searchValue: 'failed',
searchOnly: true,

View File

@@ -9,6 +9,7 @@ export default ['GetBasePath', function(GetBasePath) {
.searchable !== false);
}).map(function(i) {
delete f[i].awToolTip;
delete f[i].ngClass;
return {[i]: f[i]};
}).reduce(function (acc, i) {
var key = Object.keys(i);

View File

@@ -3,9 +3,10 @@
<div class="TagSearch-bar">
<div class="TagSearch-typeDropdown"
ng-click="toggleTypeDropdown()"
ng-class="{'is-open': showTypeDropdown}">
<span class="TagSearch-typeDropdownName">
{{ currentSearchType.label || "Foo bar"}}
ng-class="{'is-open': showTypeDropdown}"
ng-cloak>
<span class="TagSearch-typeDropdownName" ng-cloak>
{{ currentSearchType.label }}
</span>
<i class="TagSearch-selectDownIcon fa fa-angle-down"></i>
</div>

View File

@@ -1,4 +1,4 @@
export default ['Rest', '$q', 'GetBasePath', function(Rest, $q, GetBasePath) {
export default ['Rest', '$q', 'GetBasePath', 'Wait', 'ProcessErrors', function(Rest, $q, GetBasePath, Wait, ProcessErrors) {
var that = this;
// parse the field config object to return
// one of the searchTypes (for the left dropdown)
@@ -18,7 +18,7 @@ export default ['Rest', '$q', 'GetBasePath', function(Rest, $q, GetBasePath) {
var type, typeOptions;
if (field.searchType === 'select') {
type = 'select';
typeOptions = [];
typeOptions = field.searchOptions || [];
} else if (field.searchType === 'boolean') {
type = 'select';
typeOptions = [{label: "Yes", value: true},
@@ -49,6 +49,7 @@ export default ['Rest', '$q', 'GetBasePath', function(Rest, $q, GetBasePath) {
// given the fields that are searchable,
// return searchTypes in the format the view can use
this.getSearchTypes = function(list, basePath) {
Wait("start");
var defer = $q.defer();
var options = Object
@@ -95,11 +96,17 @@ export default ['Rest', '$q', 'GetBasePath', function(Rest, $q, GetBasePath) {
});
return option;
})
.error(function (data, status) {
ProcessErrors(null, data, status, null, {
hdr: 'Error!',
msg: 'Getting type options failed'});
});
Wait("stop");
defer.resolve(joinOptions());
});
} else {
Wait("stop");
defer.resolve(joinOptions());
}