Skip to content

Commit

Permalink
#533 RHS tab and filters not preserved in snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriána Kohanová committed Feb 5, 2021
1 parent 0e82dac commit 430fa7c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 37 deletions.
70 changes: 36 additions & 34 deletions js/components/datasets/datasetMoleculeListSortFilterItem.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo, useState } from 'react';
import React, { memo, useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import Button from '@material-ui/core/Button';
import Slider from '@material-ui/core/Slider';
Expand Down Expand Up @@ -120,6 +120,10 @@ export const DatasetMoleculeListSortFilter = memo(
isString
};

useEffect(() => {
setSliderValue([normMinValue, normMaxValue]);
}, [normMinValue, normMaxValue]);

const handleCheckboxChange = e => {
const isChecked = e.target.checked;

Expand Down Expand Up @@ -259,7 +263,7 @@ export const DatasetMoleculeListSortFilter = memo(
{isBoolean && (
<>
<Grid item className={classNames(classes.min, classes.centered)} style={{ width: widthMin }}>
{"False"}
{'False'}
</Grid>
<Grid item className={classNames(classes.centered, classes.slider)} style={{ width: widthSlider }}>
<Slider
Expand All @@ -268,44 +272,42 @@ export const DatasetMoleculeListSortFilter = memo(
onChangeCommitted={handleCommitChangeSlider}
valueLabelDisplay="auto"
step={null}
marks={[{ value: 1, label: "", }, { value: 50, label: "Ignore", }, { value: 100, label: "", },]}
getAriaValueText={
value => {
if (value === 0) {
return "";
} else if (value === 100) {
return "";
} else {
return "Ignore";
}
marks={[
{ value: 1, label: '' },
{ value: 50, label: 'Ignore' },
{ value: 100, label: '' }
]}
getAriaValueText={value => {
if (value === 0) {
return '';
} else if (value === 100) {
return '';
} else {
return 'Ignore';
}
}
getAriaLabel={
index => {
if (index === 0) {
return "False";
} else if (index === 1) {
return "Ignore";
} else {
return "True";
}
}}
getAriaLabel={index => {
if (index === 0) {
return 'False';
} else if (index === 1) {
return 'Ignore';
} else {
return 'True';
}
}
valueLabelFormat={
value => {
if (value === 1) {
return "False";
} else if (value === 50) {
return "Ignore";
} else {
return "True";
}
}}
valueLabelFormat={value => {
if (value === 1) {
return 'False';
} else if (value === 50) {
return 'Ignore';
} else {
return 'True';
}
}
}}
/>
</Grid>
<Grid item className={classNames(classes.min, classes.centered)} style={{ width: widthMin }}>
{"True"}
{'True'}
</Grid>
</>
)}
Expand Down
7 changes: 4 additions & 3 deletions js/reducers/tracking/trackingActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,10 +898,11 @@ export const findTrackAction = (action, state) => {
newProperties: newProperties,
newSettings: action.payload.settings,
dataset_id: action.payload.datasetID,
key: key,
text:
key === 'clear'
? `Filter ${actionDescription.CHANGED} to default values of dataset: ${action.payload.datasetID}`
: `Filter parameter: ${action.payload.key} ${actionDescription.CHANGED} of dataset: ${action.payload.datasetID}. ${descriptionProperties}`
: `Filter parameter: ${key} ${actionDescription.CHANGED} ${descriptionProperties} of dataset: ${action.payload.datasetID}`
};
}
} else if (action.type === customDatasetConstants.SET_FILTER_SHOWED_SCORE_PROPERTIES) {
Expand Down Expand Up @@ -1248,9 +1249,9 @@ const getFilterKeyChange = (oldValue, newValue) => {
if (oldValue && newValue) {
if (oldValue.order !== newValue.order) {
description +=
' from value: order:' +
' from value: order: ' +
getOrderDescription(oldValue.order) +
' to value: order:' +
' to value: order: ' +
getOrderDescription(newValue.order);
return description;
} else if (oldValue.newPrio !== newValue.newPrio) {
Expand Down

0 comments on commit 430fa7c

Please sign in to comment.