Skip to content

Commit

Permalink
Remove diff mode
Browse files Browse the repository at this point in the history
  • Loading branch information
michellemounde committed Dec 15, 2023
1 parent a7962a7 commit afb7539
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions ui/src/views/Rules/ListRules/index.jsx
Expand Up @@ -14,7 +14,7 @@ import RadioGroup from '@material-ui/core/RadioGroup';
import FormControl from '@material-ui/core/FormControl';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import FormLabel from '@material-ui/core/FormLabel';
import Checkbox from '@material-ui/core/Checkbox';
// import Checkbox from '@material-ui/core/Checkbox';
import Switch from '@material-ui/core/Switch';
import SpeedDialAction from '@material-ui/lab/SpeedDialAction';
import Drawer from '@material-ui/core/Drawer';
Expand Down Expand Up @@ -163,7 +163,7 @@ function ListRules(props) {
const [dateTimePickerError, setDateTimePickerError] = useState(null);
const [rewindDate, setRewindDate] = useState(null);
const [rewindDateError, setRewindDateError] = useState(null);
const [showRewindDiff, setShowRewindDiff] = useState(false);
// const [showRewindDiff, setShowRewindDiff] = useState(false);
const [scrollToRow, setScrollToRow] = useState(null);
const [roles, setRoles] = useState([]);
const [requiredRoles, setRequiredRoles] = useState([]);
Expand Down Expand Up @@ -310,8 +310,8 @@ function ListRules(props) {
setSnackbarState({ message, variant, open: true });
};

const handleRewindDiffChange = ({ target: { checked: value } }) =>
setShowRewindDiff(value);
// const handleRewindDiffChange = ({ target: { checked: value } }) =>
// setShowRewindDiff(value);
const handleSnackbarClose = (event, reason) => {
if (reason === 'clickaway') {
return;
Expand Down Expand Up @@ -1280,24 +1280,24 @@ function ListRules(props) {
// if we're in rewind mode, rule is a historical rule, not the current one
const rule = filteredRulesWithScheduledChanges[index];
const isSelected = isRuleSelected(rule);
const currentRule = rulesWithScheduledChanges.find(
r => r.rule_id === rule.rule_id
);

if (rewoundRules.length !== 0) {
// TODO: horrible hack, need to fix this
// maybe add diffAgainst argument to RuleCard
// to control whether or not DiffRule is shown
if (showRewindDiff && currentRule) {
rule.scheduledChange = currentRule;
rule.scheduledChange.change_type = 'update';
rule.scheduledChange.required_signoffs = {};
rule.scheduledChange.signoffs = {};
rule.scheduledChange.when = new Date();
} else if (rule.scheduledChange) {
delete rule.scheduledChange;
}
}
// const currentRule = rulesWithScheduledChanges.find(
// r => r.rule_id === rule.rule_id
// );

// if (rewoundRules.length !== 0) {
// // TODO: horrible hack, need to fix this
// // maybe add diffAgainst argument to RuleCard
// // to control whether or not DiffRule is shown
// if (showRewindDiff && currentRule) {
// rule.scheduledChange = currentRule;
// rule.scheduledChange.change_type = 'update';
// rule.scheduledChange.required_signoffs = {};
// rule.scheduledChange.signoffs = {};
// rule.scheduledChange.when = new Date();
// } else if (rule.scheduledChange) {
// delete rule.scheduledChange;
// }
// }

return (
<div
Expand Down Expand Up @@ -1375,14 +1375,14 @@ function ListRules(props) {
onDateTimeChange={handleRewindDateTimeChange}
value={rewindDate}
/>
<FormControl className={classes.checkbox}>
{/* <FormControl className={classes.checkbox}>
<FormLabel>Diff?</FormLabel>
<Checkbox
disabled={!rewindDate}
checked={showRewindDiff}
onChange={handleRewindDiffChange}
/>
</FormControl>
</FormControl> */}
<FormControl className={classes.pendingSignoffFormControl}>
<FormLabel className={classes.pendingSignoffFormLabel}>
Filter by rules with scheduled changes
Expand Down

0 comments on commit afb7539

Please sign in to comment.