The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/dashboard/components/PanelEditor/state/getRecentOptions.ts

29 lines
914 B

import { OptionsPaneCategoryDescriptor } from '../OptionsPaneCategoryDescriptor';
import { OptionsPaneItemDescriptor } from '../OptionsPaneItemDescriptor';
export function getRecentOptions(allOptions: OptionsPaneCategoryDescriptor[]) {
const popularOptions: OptionsPaneItemDescriptor[] = [];
for (const category of allOptions) {
for (const item of category.items) {
if (item.props.title === 'Unit') {
item.props.popularRank = 2;
}
if (item.props.title === 'Min') {
item.props.popularRank = 3;
}
if (item.props.title === 'Max') {
item.props.popularRank = 4;
}
if (item.props.title === 'Display name') {
item.props.popularRank = 5;
}
if (item.props.popularRank) {
popularOptions.push(item);
}
}
}
return popularOptions.sort((left, right) => left.props.popularRank! - right.props.popularRank!);
}