NodeGraph: Fix sorting markers in grid view (#35200)

* Fix test data field label

* Fix sorting

* Changed icon for sorting
pull/35217/head
Andrej Ocenas 5 years ago committed by GitHub
parent 49075f235f
commit 1dc387536e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      public/app/plugins/datasource/testdata/testData/serviceMapResponse.ts
  2. 4
      public/app/plugins/panel/nodeGraph/Legend.tsx
  3. 4
      public/app/plugins/panel/nodeGraph/layout.ts

@ -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…
Cancel
Save