mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
* Starting moving more stuff into data source picker * WIP progress * Progress on datasource picker rethink * Things are working now some details to figure out * Removed commented part * Complex work on getting data source lists * Fixed variable support showing correct data sources * Tried fixing dashboard import but failed * Fixes * Fixed import dashboard * Fixed unit test * Fixed explore test * Fixed test * Fix * fixed more tests * fixed more tests * fixed showing which option is default in picker * Changed query variable to use data source picker, updated tests and e2e * Fixed more tests * Updated snapshots, had wrong typescript version
20 lines
803 B
TypeScript
20 lines
803 B
TypeScript
import { createSelector } from 'reselect';
|
|
import { ExploreItemState } from 'app/types';
|
|
import { filterLogLevels, dedupLogRows } from 'app/core/logs_model';
|
|
|
|
const logsRowsSelector = (state: ExploreItemState) => state.logsResult && state.logsResult.rows;
|
|
const hiddenLogLevelsSelector = (state: ExploreItemState) => state.hiddenLogLevels;
|
|
const dedupStrategySelector = (state: ExploreItemState) => state.dedupStrategy;
|
|
export const deduplicatedRowsSelector = createSelector(
|
|
logsRowsSelector,
|
|
hiddenLogLevelsSelector,
|
|
dedupStrategySelector,
|
|
function dedupRows(rows, hiddenLogLevels, dedupStrategy) {
|
|
if (!(rows && rows.length)) {
|
|
return rows;
|
|
}
|
|
const filteredRows = filterLogLevels(rows, new Set(hiddenLogLevels));
|
|
return dedupLogRows(filteredRows, dedupStrategy);
|
|
}
|
|
);
|