mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-29 20:18:05 +01:00
32 lines
668 B
JavaScript
32 lines
668 B
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.details')
|
|
.filter('name', nameFilter);
|
|
|
|
function nameFilter() {
|
|
|
|
return filter;
|
|
|
|
function filter(input, filterInput, key) {
|
|
input = input || [];
|
|
var filteredResults = [];
|
|
|
|
if (filterInput !== '') {
|
|
for(var i = 0; i < input.length; i++) {
|
|
var item = input[i];
|
|
if((key === "" && item.indexOf(filterInput) >= 0) || (key !== "" && item[key].indexOf(filterInput) >= 0)) {
|
|
filteredResults.push(item);
|
|
continue;
|
|
}
|
|
}
|
|
input = filteredResults;
|
|
}
|
|
return input;
|
|
}
|
|
}
|
|
|
|
|
|
})(); |