Skip to content

Commit

Permalink
Use name of page in key in results (#1275)
Browse files Browse the repository at this point in the history
* Use name of page in `key` in results

* Disable grouping on input files
  • Loading branch information
ostatni5 authored Oct 17, 2023
1 parent f8b0d49 commit dc06941
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/JsRoot/GraphData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function generateGraphs(
.map(({ page, graph, filter }, idx) => {
return (
<Grid
key={`graph_${name}${jobId ? '_' + jobId : ''}_${idx}`}
key={`graph_${name}${jobId ? '_' + jobId : ''}_${page.name ?? idx}`}
item
xs={12}>
<Card>
Expand Down
39 changes: 30 additions & 9 deletions src/WrapperApp/components/Results/ResultsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SyntheticEvent, useEffect, useState } from 'react';
import { Estimator, generateGraphs, isPage0d, Page, Page0D } from '../../../JsRoot/GraphData';
import { useDialog } from '../../../services/DialogService';
import { useStore } from '../../../services/StoreService';
import { InfoTooltip } from '../../../shared/components/tooltip/InfoTooltip';
import { titleToKebabCase } from '../../../ThreeEditor/components/Dialog/CustomDialog';
import { TabPanel } from '../Panels/TabPanel';
import TablePage0D from './ResultsTable';
Expand Down Expand Up @@ -60,6 +61,8 @@ function ResultsPanel() {
return estimatorResults;
};

const resultsGeneratedFromProjectFile = !!simulation?.input.inputJson;

return (
<Box
sx={{
Expand Down Expand Up @@ -93,15 +96,32 @@ function ResultsPanel() {
alignItems: 'center',
gap: '0.5rem'
}}>
<FormControlLabel
control={
<Switch
checked={groupQuantities}
onChange={e => setGroupQuantities(e.target.checked)}
<Box
sx={{
display: 'flex',
alignItems: 'center',
marginRight: '0.5rem'
}}>
<FormControlLabel
sx={{ marginRight: '0' }}
control={
<Switch
checked={groupQuantities}
onChange={e => setGroupQuantities(e.target.checked)}
disabled={!resultsGeneratedFromProjectFile}
/>
}
label='Group Quantities'
/>
{!resultsGeneratedFromProjectFile && (
<InfoTooltip
sx={{ marginLeft: '0.25rem' }}
title={
'Grouping quantities is only available when results are generated from a project file.'
}
/>
}
label='Group Quantities'
/>
)}
</Box>
<Button
color='info'
size='small'
Expand Down Expand Up @@ -202,7 +222,8 @@ function ResultsPanel() {
)}
{generateGraphs(
estimator,
groupQuantities,
resultsGeneratedFromProjectFile &&
groupQuantities,
simulation?.jobId
)}
</Box>
Expand Down
6 changes: 5 additions & 1 deletion src/shared/components/tooltip/InfoTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import { SxProps, Theme } from '@mui/material/styles';
import Tooltip from '@mui/material/Tooltip';
import * as React from 'react';

interface InfoTooltipProps {
title: string;
sx?: SxProps<Theme> | undefined;
}

export const InfoTooltip = (props: InfoTooltipProps) => {
return (
<Tooltip title={props.title}>
<Tooltip
title={props.title}
sx={props.sx}>
<InfoOutlinedIcon />
</Tooltip>
);
Expand Down

0 comments on commit dc06941

Please sign in to comment.