mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 03:35:21 +01:00
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.details')
|
|
.config(routeConfig)
|
|
.filter('name', nameFilter);
|
|
|
|
|
|
function routeConfig($routeProvider) {
|
|
$routeProvider
|
|
.when('/repositories', {
|
|
templateUrl: '/static/ng/resources/js/layout/repository/repository.controller.html',
|
|
controller: 'RepositoryController',
|
|
controllerAs: 'vm'
|
|
})
|
|
.when('/users', {
|
|
templateUrl: '/static/ng/resources/js/layout/project-member/project-member.controller.html',
|
|
controller: 'ProjectMemberController',
|
|
controllerAs: 'vm'
|
|
})
|
|
.when('/logs', {
|
|
templateUrl: '/static/ng/resources/js/layout/log/log.controller.html',
|
|
controller: 'LogController',
|
|
controllerAs: 'vm'
|
|
});
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
})(); |