grafana/public/app/features/api-keys/state/selectors.ts

12 lines
328 B
TypeScript
Raw Normal View History

import { ApiKeysState } from 'app/types';
2018-10-10 18:05:50 -05:00
export const getApiKeysCount = (state: ApiKeysState) => state.keys.length;
export const getApiKeys = (state: ApiKeysState) => {
const regex = RegExp(state.searchQuery, 'i');
return state.keys.filter((key) => {
return regex.test(key.name) || regex.test(key.role);
});
};