mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NodeGraph: Fix sorting markers in grid view (#35200)
* Fix test data field label * Fix sorting * Changed icon for sorting
This commit is contained in:
parent
49075f235f
commit
1dc387536e
@ -172,7 +172,7 @@ export const nodes = {
|
||||
{
|
||||
name: NodeGraphDataFrameFieldNames.arc + 'faults',
|
||||
type: FieldType.number,
|
||||
config: { color: { mode: FieldColorModeId.Fixed, fixedColor: 'red' }, displayName: 'faults' },
|
||||
config: { color: { mode: FieldColorModeId.Fixed, fixedColor: 'red' }, displayName: 'Faults' },
|
||||
values: [
|
||||
0,
|
||||
0,
|
||||
|
@ -38,7 +38,7 @@ export const Legend = function Legend(props: Props) {
|
||||
(item) => {
|
||||
onSort({
|
||||
field: item.data!.field,
|
||||
ascending: item.data!.field === sort?.field ? !sort?.ascending : true,
|
||||
ascending: item.data!.field === sort?.field ? !sort?.ascending : false,
|
||||
});
|
||||
},
|
||||
[sort, onSort]
|
||||
@ -55,7 +55,7 @@ export const Legend = function Legend(props: Props) {
|
||||
<>
|
||||
<VizLegendListItem item={item} className={styles.item} onLabelClick={sortable ? onClick : undefined} />
|
||||
{sortable &&
|
||||
(sort?.field === item.data!.field ? <Icon name={sort!.ascending ? 'angle-up' : 'angle-down'} /> : '')}
|
||||
(sort?.field === item.data!.field ? <Icon name={sort!.ascending ? 'arrow-up' : 'arrow-down'} /> : '')}
|
||||
</>
|
||||
);
|
||||
}}
|
||||
|
@ -179,8 +179,8 @@ function gridLayout(
|
||||
const val1 = sort!.field.values.get(node1.dataFrameRowIndex);
|
||||
const val2 = sort!.field.values.get(node2.dataFrameRowIndex);
|
||||
|
||||
// Lets pretend we don't care about type for a while
|
||||
return sort!.ascending ? val2 - val1 : val1 - val2;
|
||||
// Lets pretend we don't care about type of the stats for a while (they can be strings)
|
||||
return sort!.ascending ? val1 - val2 : val2 - val1;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user