Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use name of page in key in results #1275

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading