mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Revert data links code for sorted vector case (#57175)
This commit is contained in:
parent
4cee910971
commit
9c514748f7
@ -16,10 +16,6 @@ export class SortedVector<T = any> implements Vector<T> {
|
|||||||
return this.source.get(this.order[index]);
|
return this.source.get(this.order[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderIndex(index: number): number {
|
|
||||||
return this.order[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
toArray(): T[] {
|
toArray(): T[] {
|
||||||
return vectorToArray(this);
|
return vectorToArray(this);
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,7 @@ import { css as cssCore, Global } from '@emotion/react';
|
|||||||
import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useClickAway } from 'react-use';
|
import { useClickAway } from 'react-use';
|
||||||
|
|
||||||
import {
|
import { CartesianCoords2D, DataFrame, getFieldDisplayName, InterpolateFunction, TimeZone } from '@grafana/data';
|
||||||
CartesianCoords2D,
|
|
||||||
DataFrame,
|
|
||||||
getFieldDisplayName,
|
|
||||||
InterpolateFunction,
|
|
||||||
SortedVector,
|
|
||||||
TimeZone,
|
|
||||||
ValueLinkConfig,
|
|
||||||
} from '@grafana/data';
|
|
||||||
import {
|
import {
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
GraphContextMenuHeader,
|
GraphContextMenuHeader,
|
||||||
@ -257,27 +249,23 @@ export const ContextMenuView: React.FC<ContextMenuViewProps> = ({
|
|||||||
|
|
||||||
const hasLinks = field.config.links && field.config.links.length > 0;
|
const hasLinks = field.config.links && field.config.links.length > 0;
|
||||||
|
|
||||||
const valueLinkConfig: ValueLinkConfig = {};
|
|
||||||
|
|
||||||
if (field.values instanceof SortedVector) {
|
|
||||||
valueLinkConfig.valueRowIndex = field.values.getOrderIndex(dataIdx);
|
|
||||||
} else {
|
|
||||||
valueLinkConfig.valueRowIndex = dataIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasLinks) {
|
if (hasLinks) {
|
||||||
if (field.getLinks) {
|
if (field.getLinks) {
|
||||||
items.push({
|
items.push({
|
||||||
items: field.getLinks(valueLinkConfig).map<MenuItemProps>((link) => {
|
items: field
|
||||||
return {
|
.getLinks({
|
||||||
label: link.title,
|
valueRowIndex: dataIdx,
|
||||||
ariaLabel: link.title,
|
})
|
||||||
url: link.href,
|
.map<MenuItemProps>((link) => {
|
||||||
target: link.target,
|
return {
|
||||||
icon: link.target === '_self' ? 'link' : 'external-link-alt',
|
label: link.title,
|
||||||
onClick: link.onClick,
|
ariaLabel: link.title,
|
||||||
};
|
url: link.href,
|
||||||
}),
|
target: link.target,
|
||||||
|
icon: link.target === '_self' ? 'link' : 'external-link-alt',
|
||||||
|
onClick: link.onClick,
|
||||||
|
};
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user