• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dataunitylab / relational-playground / #107

09 Sep 2025 03:15PM UTC coverage: 78.436% (-7.9%) from 86.296%
#107

push

michaelmior
Update Node to 24

Signed-off-by: Michael Mior <mmior@mail.rit.edu>

517 of 731 branches covered (70.73%)

Branch coverage included in aggregate %.

1018 of 1226 relevant lines covered (83.03%)

14584.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/CurrentRelExpr.js
1
// @flow
2
import React, {useState} from 'react';
3
import {useDispatch, useSelector} from 'react-redux';
4
import {changeExpr} from './modules/data';
5
import RelExpr from './RelExpr';
6
import RelExprTree from './RelExprTree';
7

8
import type {StatelessFunctionalComponent} from 'react';
9
import {disableOptimization, enableOptimization} from './modules/relexp';
10

11
import type {State} from './modules/relexp';
12

13
type Props = {
14
  ReactGA: any,
15
};
16

17
const CurrentRelExpr: StatelessFunctionalComponent<Props> = (props) => {
2✔
18
  const dispatch = useDispatch();
4✔
19
  const expr = useSelector<{relexp: State}, _>((state) => state.relexp.expr);
6✔
20
  const [showTree, setShowTree] = useState(false);
4✔
21
  const optimized = useSelector<{relexp: State}, _>(
4✔
22
    (state) => state.relexp.optimized
6✔
23
  );
24

25
  function handleTreeInputChange(event: SyntheticInputEvent<HTMLInputElement>) {
26
    if (props.ReactGA) {
2!
27
      props.ReactGA.event({
2✔
28
        category: 'Toggle Expression Display',
29
        action: event.target.checked ? 'tree' : 'linear',
2✔
30
      });
31
    }
32
    setShowTree(event.target.checked);
2✔
33
  }
34

35
  function handleOptimizeInputChange(
36
    event: SyntheticInputEvent<HTMLInputElement>
37
  ) {
38
    if (event.target.checked) {
2✔
39
      dispatch(enableOptimization('join'));
1✔
40
    } else {
41
      dispatch(disableOptimization());
1✔
42
    }
43
  }
44

45
  const relExp = showTree ? (
4✔
46
    <RelExprTree
47
      ReactGA={props.ReactGA}
48
      expr={expr}
49
      changeExpr={(data, element) => dispatch(changeExpr(data, element))}
×
50
    />
51
  ) : (
52
    <RelExpr
53
      ReactGA={props.ReactGA}
54
      expr={expr}
55
      changeExpr={(data, element) => dispatch(changeExpr(data, element))}
×
56
    />
57
  );
58

59
  return (
4✔
60
    <div className="relExprContainer">
61
      <div className="toggle">
62
        <label>
63
          Tree view
64
          <input
65
            type="checkbox"
66
            checked={showTree}
67
            onChange={handleTreeInputChange}
68
          />
69
        </label>
70
      </div>
71
      <div className="toggle">
72
        <label>
73
          Query Optimization
74
          <input
75
            type="checkbox"
76
            checked={optimized}
77
            onChange={handleOptimizeInputChange}
78
          />
79
        </label>
80
      </div>
81

82
      {/* Relational algebra expression display */}
83
      <div className="expr">{relExp}</div>
84
    </div>
85
  );
86
};
87

88
export default CurrentRelExpr;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc