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

* Fix test data field label

* Fix sorting

* Changed icon for sorting
This commit is contained in:
Andrej Ocenas 2021-06-03 23:52:20 +02:00 committed by GitHub
parent 49075f235f
commit 1dc387536e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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,

View File

@ -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'} /> : '')}
</>
);
}}

View File

@ -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;
});
}