open-consul/ui/packages/consul-ui/app/search/predicates/token.js

21 lines
867 B
JavaScript

export default {
Name: (item, value) => item.Name.toLowerCase().indexOf(value.toLowerCase()) !== -1,
Description: (item, value) => item.Description.toLowerCase().indexOf(value.toLowerCase()) !== -1,
AccessorID: (item, value) => item.AccessorID.toLowerCase().indexOf(value.toLowerCase()) !== -1,
Role: (item, value) =>
(item.Roles || []).some(item => item.Name.toLowerCase().indexOf(value.toLowerCase()) !== -1),
Policy: (item, value) => {
return (
(item.Policies || []).some(
item => item.Name.toLowerCase().indexOf(value.toLowerCase()) !== -1
) ||
(item.ServiceIdentities || []).some(
item => item.ServiceName.toLowerCase().indexOf(value.toLowerCase()) !== -1
) ||
(item.NodeIdentities || []).some(
item => item.NodeName.toLowerCase().indexOf(value.toLowerCase()) !== -1
)
);
},
};