Skip to content

Commit 1a89fb8

Browse files
authored
Cleanup some details related to query groups
1 parent 6312ebd commit 1a89fb8

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/IconProvider/IconProvider.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import FunctionsIcon from '@mui/icons-material/Functions';
66
import ListAltIcon from '@mui/icons-material/ListAlt';
77
import FactoryIcon from '@mui/icons-material/Factory';
88
import BugReportIcon from '@mui/icons-material/BugReport';
9+
import ConstructionIcon from '@mui/icons-material/Construction';
910

1011
export default {
1112
BrushIcon,
@@ -15,5 +16,6 @@ export default {
1516
FunctionsIcon,
1617
ListAltIcon,
1718
FactoryIcon,
18-
BugReportIcon
19+
BugReportIcon,
20+
ConstructionIcon
1921
};

src/components/InteractionLayout/SelectionMenu/SelectionMenu.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import Collapse from '@mui/material/Collapse';
1212
import ExpandLess from '@mui/icons-material/ExpandLess';
1313
import ExpandMore from '@mui/icons-material/ExpandMore';
1414
import IconProvider from "../../../IconProvider/IconProvider";
15-
import ViewListIcon from '@mui/icons-material/ViewList';
15+
import ListAltIcon from '@mui/icons-material/ListAlt';
1616

1717
/**
1818
* A custom menu as defined in React Admin for selecting the query the user whishes to execute.
1919
* @returns {Component} the selection menu component
2020
*/
2121
function SelectionMenu() {
2222
const resources = useResourceDefinitions();
23-
const queryGroups = config.queryGroups;
23+
const queryGroups = config.queryGroups || [];
2424

2525
// adding a list to the group that will contain all the queries for said group
2626
queryGroups.forEach(group => group.queries = [])
@@ -120,7 +120,7 @@ const getIconComponent = (iconKey) => {
120120
if (IconComponent) {
121121
return <IconComponent />;
122122
}
123-
return <ViewListIcon />;
123+
return <ListAltIcon />;
124124
};
125125

126126
const TooltipContent = ({ title, description }) => (
@@ -156,7 +156,12 @@ const setUpQueryGroups = (queryGroups, resources) => {
156156
if (resources[id].options.queryGroupId === undefined) {
157157
looseQueries.push(id)
158158
} else {
159-
queryGroups.find(group => group.id === resources[id].options.queryGroupId).queries.push(id)
159+
const queryGroup = queryGroups.find(group => group.id === resources[id].options.queryGroupId);
160+
if (queryGroup) {
161+
queryGroup.queries.push(id);
162+
} else {
163+
looseQueries.push(id);
164+
}
160165
}
161166
} catch (error) {
162167
throw new Error(`Error adding queries to a group: ${error.message}`);

src/config.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
"queryGroups" : [
1616
{
1717
"id": "a-ex",
18-
"name": "General examples",
19-
"icon": "ListAltIcon"
18+
"name": "General examples"
2019
},
2120
{
2221
"id": "b-prj",

0 commit comments

Comments
 (0)