Skip to content

Commit c6d03e3

Browse files
committed
Add Snapshot dropdown to Performance tab
1 parent 888872e commit c6d03e3

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/app/components/BarGraph.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,14 @@ const BarGraph = props => {
7777
scroll: true,
7878
});
7979
const keys = Object.keys(data.componentData);
80+
console.log('this is data in barGraph.tsx: ', data);
81+
console.log('these are the data\'s keys: ', keys)
8082

8183
// data accessor (used to generate scales) and formatter (add units for on hover box)
82-
const getSnapshotId = (d: snapshot) => d.snapshotId;
84+
const getSnapshotId = (d: snapshot) => {
85+
console.log('snapshot object here: ', d);
86+
return d.snapshotId;
87+
}
8388
const formatSnapshotId = id => `Snapshot ID: ${id}`;
8489
const formatRenderTime = time => `${time} ms `;
8590

@@ -99,6 +104,8 @@ const BarGraph = props => {
99104
range: schemeSet3,
100105
});
101106

107+
console.log()
108+
102109
// setting max dimensions and scale ranges
103110
const xMax = width - margin.left - margin.right;
104111
const yMax = height - margin.top - 150;
@@ -116,6 +123,7 @@ const BarGraph = props => {
116123
for (let i = 0; i < saveButtons.length; i++) {
117124
if (tabs[currentTab].seriesSavedStatus === 'saved') {
118125
saveButtons[i].classList.add('animate');
126+
console.log('checking saveButtons[i].classList', saveButtons[i].classList)
119127
saveButtons[i].innerHTML = 'Saved!';
120128
} else {
121129
saveButtons[i].innerHTML = 'Save Series';
@@ -137,6 +145,7 @@ const BarGraph = props => {
137145
dispatch(save(toStorage));
138146
};
139147

148+
// FTRI9 note - need to ensure text box is not empty before saving
140149
const textbox = tabs[currentTab].seriesSavedStatus === 'inputBoxOpen' ? <input type="text" id="seriesname" placeholder="Enter Series Name" onChange={e => setSeriesNameInput(e.target.value)} /> : null;
141150
return (
142151
<div className="bargraph-position">
@@ -166,6 +175,23 @@ const BarGraph = props => {
166175
))}
167176
</select>
168177
</form>
178+
<form className="routesForm" id="routes-formcontrol">
179+
<label id="routes-dropdown">Select Snapshot: </label>
180+
<select
181+
labelId="demo-simple-select-label"
182+
id="routes-select"
183+
onChange={e => setSnapshot(e.target.value)}
184+
>
185+
<option>
186+
All Snapshots
187+
</option>
188+
{filteredSnapshots.map(route => (
189+
<option className="routes">
190+
{route.snapshotId}
191+
</option>
192+
))}
193+
</select>
194+
</form>
169195
</div>
170196
<svg ref={containerRef} width={width} height={height}>
171197
<rect
@@ -197,6 +223,9 @@ const BarGraph = props => {
197223
color={colorScale}
198224
>
199225
{barStacks => barStacks.map(barStack => barStack.bars.map((bar, idx) => {
226+
console.log(width, '<-- width');
227+
console.log(height, '<-- height');
228+
console.log(bar, '<-- bar');
200229
// Hides new components if components don't exist in previous snapshots.
201230
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
202231
bar.height = 0;

src/app/components/PerformanceVisx.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ const PerformanceVisx = (props: BarStackProps) => {
179179
const [action, setAction] = useState(false);
180180

181181
const [route, setRoute] = useState('All Routes');
182+
const [snapshot, setSnapshot] = useState('Choose Snapshot ID');
182183

183184
useEffect(() => {
184185
dispatch(setCurrentTabInApp('performance'));
@@ -245,6 +246,8 @@ const PerformanceVisx = (props: BarStackProps) => {
245246
if (route !== 'All Routes') {
246247
data.barStack = filteredSnapshots;
247248
}
249+
250+
console.log(filteredSnapshots, '<-- filtered snap shots');
248251

249252
const renderBargraph = () => {
250253
if (hierarchy) {
@@ -258,6 +261,7 @@ const PerformanceVisx = (props: BarStackProps) => {
258261
setRoute={setRoute}
259262
allRoutes={allRoutes}
260263
filteredSnapshots={filteredSnapshots}
264+
setSnapshot={setSnapshot}
261265
/>
262266
</div>
263267
);

0 commit comments

Comments
 (0)