Skip to content

Commit dce7127

Browse files
authored
Merge pull request #198 from thingsdb/packages
Packages updated
2 parents 68f41d0 + 88fb412 commit dce7127

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+3446
-3929
lines changed

react/.eslintrc.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ module.exports = {
1111
'experimentalObjectRestSpread': true,
1212
'jsx': true
1313
},
14-
'sourceType': 'module'
14+
'sourceType': 'module',
15+
'requireConfigFile': false,
16+
'babelOptions': {
17+
'presets': ['@babel/preset-react']
18+
},
1519
},
16-
'parser': 'babel-eslint',
20+
'parser': '@babel/eslint-parser',
1721
'plugins': [
1822
'react',
1923
'react-hooks'

react/package-lock.json

Lines changed: 3032 additions & 3416 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react/package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "things-gui",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"description": "ThingsGUI",
55
"main": "index.js",
66
"repository": {
@@ -17,54 +17,54 @@
1717
},
1818
"author": "",
1919
"dependencies": {
20-
"@babel/cli": "7.16.8",
21-
"@babel/core": "7.16.12",
22-
"@babel/plugin-proposal-class-properties": "7.16.7",
20+
"@babel/cli": "7.17.10",
21+
"@babel/core": "7.17.12",
22+
"@babel/plugin-proposal-class-properties": "7.17.12",
2323
"@babel/plugin-syntax-dynamic-import": "7.8.3",
2424
"@babel/plugin-syntax-object-rest-spread": "7.8.3",
2525
"@babel/plugin-transform-object-assign": "7.16.7",
26-
"@babel/plugin-transform-runtime": "7.16.10",
26+
"@babel/plugin-transform-runtime": "7.17.12",
2727
"@babel/polyfill": "7.12.1",
28-
"@babel/preset-env": "7.16.11",
29-
"@babel/preset-react": "7.16.7",
30-
"@babel/register": "7.16.9",
31-
"@babel/runtime": "7.16.7",
32-
"@emotion/react": "11.7.1",
33-
"@emotion/styled": "11.6.0",
34-
"@mui/icons-material": "5.3.1",
35-
"@mui/lab": "5.0.0-alpha.66",
36-
"@mui/material": "5.3.1",
37-
"babel-loader": "8.2.3",
38-
"css-loader": "5.2.7",
28+
"@babel/preset-env": "7.17.12",
29+
"@babel/register": "7.17.7",
30+
"@babel/runtime": "7.17.9",
31+
"@emotion/react": "11.9.0",
32+
"@emotion/styled": "11.8.1",
33+
"@mui/icons-material": "5.8.0",
34+
"@mui/lab": "5.0.0-alpha.82",
35+
"@mui/material": "5.8.0",
36+
"babel-loader": "8.2.5",
37+
"css-loader": "6.7.1",
3938
"deep-equal": "2.0.5",
4039
"file-loader": "6.2.0",
41-
"moment": "2.29.2",
42-
"monaco-editor": "0.31.1",
40+
"moment": "2.29.3",
41+
"monaco-editor": "0.33.0",
4342
"monaco-editor-webpack-plugin": "7.0.1",
44-
"npm": "8.3.2",
43+
"npm": "8.10.0",
4544
"path-browserify": "1.0.1",
4645
"prop-types": "15.8.1",
4746
"react": "17.0.2",
4847
"react-dom": "17.0.2",
49-
"react-draggable": "4.4.4",
50-
"react-dropzone": "11.5.3",
48+
"react-draggable": "4.4.5",
49+
"react-dropzone": "14.2.1",
5150
"react-helmet": "6.1.0",
52-
"react-router-dom": "5.2.0",
51+
"react-router-dom": "6.3.0",
5352
"socket.io": "2.4.1",
5453
"socket.io-client": "2.4.0",
5554
"style-loader": "3.3.1",
56-
"terser": "5.10.0",
57-
"terser-webpack-plugin": "5.3.0",
55+
"terser": "5.13.1",
56+
"terser-webpack-plugin": "5.3.1",
5857
"vlow": "1.1.14",
59-
"webpack": "5.67.0",
58+
"webpack": "5.72.1",
6059
"webpack-bundle-analyzer": "4.5.0",
6160
"webpack-cli": "4.9.2"
6261
},
6362
"devDependencies": {
64-
"babel-eslint":"10.1.0",
65-
"eslint": "7.32.0",
66-
"eslint-plugin-react": "7.28.0",
67-
"eslint-plugin-react-hooks": "4.3.0",
63+
"@babel/eslint-parser": "7.17.0",
64+
"@babel/preset-react": "7.17.12",
65+
"eslint": "8.10.0",
66+
"eslint-plugin-react": "7.29.4",
67+
"eslint-plugin-react-hooks": "4.5.0",
6868
"moment-locales-webpack-plugin": "1.2.0"
6969
}
7070
}

react/src/Components/App/App.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Route, Switch, useHistory, useLocation } from 'react-router-dom';
1+
import { Route, Routes, useLocation, useSearchParams } from 'react-router-dom';
22
import Grid from '@mui/material/Grid';
33
import IconButton from '@mui/material/IconButton';
44
import MenuIcon from '@mui/icons-material/Menu';
@@ -9,7 +9,7 @@ import Tooltip from '@mui/material/Tooltip';
99

1010
import { CollectionsMenu, OverviewMenu, ProceduresMenu, TasksMenu, TopBar, UsersMenu, QueryEditorMenu } from '../Navigation';
1111
import { COLLECTION_ROUTE, EDITOR_ROUTE, PROCEDURE_ROUTE, TASK_ROUTE, USER_ROUTE } from '../../Constants/Routes';
12-
import { DrawerLayout, ErrorToast, getIdFromPath, historyDeleteQueryParam, historyGetQueryParam, historySetQueryParam } from '../Utils';
12+
import { DrawerLayout, ErrorToast, getIdFromPath } from '../Utils';
1313
import { Procedure, Task } from '../ProceduresAndTasks';
1414
import Collection from '../Collections';
1515
import Editor from '../Editor';
@@ -21,12 +21,12 @@ import Welcome from '../Welcome';
2121

2222
const nodes = 'nodes';
2323
const App = () => {
24-
let history = useHistory();
2524
let location = useLocation();
25+
let [searchParams, setSearchParams] = useSearchParams();
2626

2727
const [menuOpen, setMenuOpen] = React.useState(true);
2828
const [drawerContent, setDrawerContent] = React.useState(() => {
29-
let drawerParam = historyGetQueryParam(history, 'drawer');
29+
let drawerParam = searchParams.get('drawer');
3030
if (drawerParam) {
3131
return drawerParam;
3232
}
@@ -39,12 +39,17 @@ const App = () => {
3939
const taskId = getIdFromPath(location.pathname, TASK_ROUTE);
4040

4141
const handleDrawerOpen = () => {
42-
historySetQueryParam(history, 'drawer', nodes);
42+
const current = Object.fromEntries(searchParams);
43+
setSearchParams({ ...current, drawer: nodes });
4344
setDrawerContent(nodes);
4445
};
4546

4647
const handleDrawerClose = () => {
47-
historyDeleteQueryParam(history, 'drawer');
48+
const drawer = searchParams.has('drawer');
49+
if (drawer) {
50+
searchParams.delete('drawer');
51+
setSearchParams(searchParams);
52+
}
4853
setDrawerContent(null);
4954
};
5055

@@ -82,14 +87,14 @@ const App = () => {
8287
mainContent={
8388
<Grid container alignItems="flex-start">
8489
<Grid container item xs={12} sx={{padding: '0px 8px 8px 8px'}}>
85-
<Switch>
86-
<Route exact path="/" component={Welcome} />
87-
<Route exact path={`/${COLLECTION_ROUTE}/${collectionName}`} component={Collection} />
88-
<Route exact path={`/${USER_ROUTE}/${userName}`} component={User} />
89-
<Route exact path={`/${PROCEDURE_ROUTE}/${procedureName}`} component={Procedure} />
90-
<Route exact path={`/${TASK_ROUTE}/${taskId}`} component={Task} />
91-
<Route exact path={`/${EDITOR_ROUTE}`} component={Editor} />
92-
</Switch>
90+
<Routes>
91+
<Route path="/" element={<Welcome />} />
92+
<Route path={`/${COLLECTION_ROUTE}/${collectionName}`} element={<Collection />} />
93+
<Route path={`/${USER_ROUTE}/${userName}`} element={<User />} />
94+
<Route path={`/${PROCEDURE_ROUTE}/${procedureName}`} element={<Procedure />} />
95+
<Route path={`/${TASK_ROUTE}/${taskId}`} element={<Task />} />
96+
<Route path={`/${EDITOR_ROUTE}`} element={<Editor />} />
97+
</Routes>
9398
</Grid>
9499
</Grid>
95100
}

react/src/Components/Collections/Config/Export.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const Label = styled(Typography)(({ theme }) => ({
4040
const tag = ExportCollectionTAG;
4141

4242
const Export = ({collection}) => {
43-
const name = React.useState(collection.name)[0]; //to prevent update of name to undefined, after it is deleted.
43+
// to prevent update of name to undefined, after it is deleted.
44+
const [name] = React.useState(collection.name); // eslint-disable-line
4445
const [show, setShow] = React.useState(false);
4546
const [script, setScript] = React.useState('');
4647

react/src/Components/Collections/Config/Remove.js

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,39 @@
1-
import { useHistory } from 'react-router-dom';
1+
import { useLocation, useNavigate } from 'react-router-dom';
22
import PropTypes from 'prop-types';
33
import React from 'react';
44
import Button from '@mui/material/Button';
5-
import FormControlLabel from '@mui/material/FormControlLabel';
6-
import Switch from '@mui/material/Switch';
75

8-
import { ErrorMsg, historyNavigate, SimpleModal } from '../../Utils';
6+
import { historyNavigate, RemoveModal } from '../../Utils';
97
import { ThingsdbActions } from '../../../Stores';
108
import { RemoveCollectionTAG } from '../../../Constants/Tags';
119

1210

1311
const tag = RemoveCollectionTAG;
1412

1513
const Remove = ({collection}) => {
16-
let history = useHistory();
17-
const [show, setShow] = React.useState(false);
18-
const name = React.useState(collection.name)[0]; //to prevent update of name to undefined, after it is deleted.
19-
const [switchDel, setSwitchDel] = React.useState(false);
14+
let navigate = useNavigate();
15+
let location = useLocation();
2016

21-
const handleClickOpen = () => {
22-
setShow(true);
23-
setSwitchDel(false);
24-
};
25-
26-
const handleClickClose = () => {
27-
setShow(false);
28-
29-
};
17+
//to prevent update of name to undefined, after it is deleted.
18+
const [name] = React.useState(collection.name); // eslint-disable-line
3019

3120
const handleClickOk = () => {
3221
ThingsdbActions.removeCollection(
3322
collection.name,
3423
tag,
35-
() => historyNavigate(history, '/'),
24+
() => historyNavigate(navigate, location, '/'),
3625
);
3726
};
3827

39-
const handleSwitch = ({target}) => {
40-
const {checked} = target;
41-
setSwitchDel(checked);
42-
};
43-
4428
return(
45-
<SimpleModal
46-
button={
47-
<Button variant="outlined" color="primary" onClick={handleClickOpen}>
48-
{'Remove'}
49-
</Button>
50-
}
51-
title={`Remove collection ${name}?`}
52-
open={show}
53-
actionButtons={
54-
<Button color="error" disabled={!switchDel} onClick={handleClickOk}>
55-
{'Submit'}
56-
</Button>
57-
}
58-
onClose={handleClickClose}
59-
>
60-
<React.Fragment>
61-
<ErrorMsg tag={tag} />
62-
<FormControlLabel
63-
control={(
64-
<Switch
65-
checked={switchDel}
66-
color="primary"
67-
id="description"
68-
onChange={handleSwitch}
69-
/>
70-
)}
71-
label="Are you really sure?"
72-
/>
73-
</React.Fragment>
74-
</SimpleModal>
29+
<RemoveModal
30+
buttonComponent={Button}
31+
buttonLabel="Remove"
32+
buttonProps={{variant: 'outlined', color: 'primary'}}
33+
onSubmit={handleClickOk}
34+
tag={tag}
35+
title={`Remove '${name}'`}
36+
/>
7537
);
7638
};
7739

react/src/Components/Collections/Config/Rename.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useHistory } from 'react-router-dom';
1+
import { useLocation, useNavigate } from 'react-router-dom';
22
import { withVlow } from 'vlow';
33
import Button from '@mui/material/Button';
44
import PropTypes from 'prop-types';
@@ -37,7 +37,9 @@ const tag = RenameCollectionTAG;
3737

3838
const Rename = ({collection, collections}) => {
3939
const [state, setState] = React.useState(initialState);
40-
let history = useHistory();
40+
let navigate = useNavigate();
41+
let location = useLocation();
42+
4143
const {show, errors, form} = state;
4244

4345
const handleClickOpen = () => {
@@ -68,7 +70,7 @@ const Rename = ({collection, collections}) => {
6870
collection.name,
6971
form.name,
7072
tag,
71-
() => historyNavigate(history, `/${COLLECTION_ROUTE}/${form.name}`)
73+
() => historyNavigate(navigate, location, `/${COLLECTION_ROUTE}/${form.name}`)
7274
);
7375
}
7476
};

react/src/Components/Collections/EnumsTypes/Utils/AddEditProperty/PropertyCallback.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {Closure} from '../../../../Utils';
1010

1111

1212
const PropertyCallback = ({onChange}) => {
13-
const [switchIni, setSwitch] = React.useState(false);
13+
const [switchCallback, setSwitchCallback] = React.useState(false);
1414

1515
const handleSwitch = ({target}) => {
1616
const {checked} = target;
17-
setSwitch(checked);
17+
setSwitchCallback(checked);
1818
if (!checked) {
1919
onChange({callback: ''});
2020
}
@@ -30,16 +30,16 @@ const PropertyCallback = ({onChange}) => {
3030
<FormControlLabel
3131
control={(
3232
<Switch
33-
checked={switchIni}
33+
checked={switchCallback}
3434
color="primary"
35-
id="switchIni"
35+
id="switchCallback"
3636
onChange={handleSwitch}
3737
/>
3838
)}
3939
label="Add a closure that will be called on each existing instance and can be used to set a new value"
4040
/>
4141
</Grid>
42-
<Collapse in={switchIni} timeout="auto" unmountOnExit sx={{width: '100%'}}>
42+
<Collapse in={switchCallback} timeout="auto" unmountOnExit sx={{width: '100%'}}>
4343
<Typography variant="caption">
4444
{'Callback'}
4545
</Typography>

react/src/Components/Collections/EnumsTypes/Utils/AddEditProperty/PropertyInitVal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import PropertyVal from './PropertyVal';
99

1010

1111
const PropertyInitVal = ({category, onChange, scope}) => {
12-
const [switchIni, setSwitch] = React.useState(false);
12+
const [switchInit, setSwitchInit] = React.useState(false);
1313

1414
const handleSwitch = ({target}) => {
1515
const {checked} = target;
16-
setSwitch(checked);
16+
setSwitchInit(checked);
1717
if (!checked) {
1818
onChange({propertyVal:'', propertyBlob: '',});
1919
}
@@ -29,16 +29,16 @@ const PropertyInitVal = ({category, onChange, scope}) => {
2929
<FormControlLabel
3030
control={(
3131
<Switch
32-
checked={switchIni}
32+
checked={switchInit}
3333
color="primary"
34-
id="switchIni"
34+
id="switchInit"
3535
onChange={handleSwitch}
3636
/>
3737
)}
3838
label="Add initial value or closure"
3939
/>
4040
</Grid>
41-
<Collapse in={switchIni} timeout="auto" unmountOnExit sx={{width: '100%'}}>
41+
<Collapse in={switchInit} timeout="auto" unmountOnExit sx={{width: '100%'}}>
4242
<PropertyVal category={category} onChange={handleVal} scope={scope} />
4343
</Collapse>
4444
</React.Fragment>

0 commit comments

Comments
 (0)