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

Enhance scenario bundle functionality #1491

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
22 changes: 11 additions & 11 deletions factsheet/frontend/src/components/comparisonBoardMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ComparisonBoardMain = (props) => {
const [scenarios, setScenarios] = useState([]);
const scenarios_uid = params.split('#');
const scenarios_uid_json = JSON.stringify(scenarios_uid);
const [selectedCriteria, setselectedCriteria] = useState(['Descriptors']);
const [selectedCriteria, setselectedCriteria] = useState(['Descriptors', 'Study name']);

const getScenarios = async () => {
const { data } = await axios.get(conf.toep + `scenario-bundles/get_scenarios/`, { params: { scenarios_uid: scenarios_uid_json } });
Expand All @@ -35,7 +35,7 @@ const ComparisonBoardMain = (props) => {
useEffect(() => {
getScenarios().then((data) => {
setScenarios(data);
});
});
}, []);


Expand Down Expand Up @@ -63,7 +63,7 @@ const ComparisonBoardMain = (props) => {
}

return (
scenarios.length !== 0 &&
scenarios.length !== 0 &&
<Grid container
direction="row"
justifyContent="space-between"
Expand All @@ -80,20 +80,20 @@ const ComparisonBoardMain = (props) => {
<Button variant="outlined" size="small" sx={{ mr: 1 }}>
<ArrowBackIcon />
</Button>
</Link>
</Link>
</Tooltip>
</Grid>
<Grid item xs={6} md={4}>
</Grid>
<Grid item xs={6} md={4}>
<Button color="primary"
variant="text"
size="small"
<Button color="primary"
variant="text"
size="small"
startIcon={<ArrowRightIcon />}>
How it works?
How it works?
</Button>
</Grid>
</Grid>
</Grid>
</Toolbar>
{/* <ComparisonControl /> */}
<OptionBox>
Expand All @@ -106,11 +106,11 @@ const ComparisonBoardMain = (props) => {
</div>
</FormGroup>
<MultipleSelectChip
sx={{ mt: 2, width : "100%" }}
sx={{ mt: 2, width: "100%" }}
options={['Scenario 1', 'Scenario 2', 'Scenario 3']}
label="Scenarios to be compared"
disabled={true}
/>
/>
</OptionBox>
<ComparisonBoardItems elements={scenarios} c_aspects={selectedCriteria} />
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const useStyles = makeStyles((theme) => ({
}));

export default function CustomAutocompleteWithoutAddNew(parameters) {
const { manyItems, idx, name, type, showSelectedElements, handler, width, noTooltip=false } = parameters;
const { manyItems, idx, name, type, showSelectedElements, handler, width, noTooltip = false } = parameters;
const [value, setValue] = useState(parameters.selectedElements !== undefined ? parameters.selectedElements : []);
const classes = useStyles();

Expand All @@ -33,34 +33,34 @@ export default function CustomAutocompleteWithoutAddNew(parameters) {
return (
<Box style={{ width: width }}>
<Autocomplete
size="small"
size="small"
multiple
id="checkboxes-tags-demo"
options={parameters.optionsSet}
disableCloseOnSelect
getOptionLabel={(option) => option.name}
renderOption={(props, option, { selected }) => (
<li {...props}>
{!option.inputValue &&<Checkbox
{!option.inputValue && <Checkbox
icon={icon}
checkedIcon={checkedIcon}
style={{ marginRight: 8 }}
checked={ selected }
checked={selected}
/>}
{!noTooltip && !option.inputValue && <HtmlTooltip
style={{ marginRight: '5px' }}
placement="top"
title={
<React.Fragment>
<Typography color="inherit" variant="caption">
Description of <b>{option.name}</b> : TDB ...
<br />
<a href={2}>More info from Open Enrgy Knowledge Graph (OEKG)...</a>
</Typography>
</React.Fragment>
}
style={{ marginRight: '5px' }}
placement="top"
title={
<React.Fragment>
<Typography color="inherit" variant="caption">
Description of <b>{option.name}</b> : TDB ...
<br />
<a href={2}>More info from Open Enrgy Knowledge Graph (OEKG)...</a>
</Typography>
</React.Fragment>
}
>
<HelpOutlineIcon sx={{ color: '#bdbdbd' }}/>
<HelpOutlineIcon sx={{ color: '#bdbdbd' }} />
</HtmlTooltip>}
{option.name}
</li>
Expand All @@ -75,7 +75,7 @@ export default function CustomAutocompleteWithoutAddNew(parameters) {
classes: {
root: classes.inputRoot, // Apply the custom CSS class
},
}}/>
}} />
)}
/>
{showSelectedElements && <Box
Expand All @@ -90,11 +90,11 @@ export default function CustomAutocompleteWithoutAddNew(parameters) {
// 'backgroundColor':'#FCFCFC'
}}
>
{value.map((v) => (
<Chip size='small' key={v.id} label={v.name} variant="outlined" sx={{ 'marginBottom': '5px', 'marginTop': '5px', 'marginLeft': '5px' }}/>
{value.sort((a, b) => a.name.localeCompare(b.name)).map((v) => (
<Chip size='small' key={v.id} label={v.name} variant="outlined" sx={{ 'marginBottom': '5px', 'marginTop': '5px', 'marginLeft': '5px' }} />
))}
</Box>}
</Box>
);

}
Loading
Loading