Merged in migration (pull request #4)

Migration

* README.md was updated and the webpack was modified in package web2d
* README.md was updated and the webpack was modified in package mindplot
* Merge branch 'develop' of https://bitbucket.org/lilabyus/wisemapping-frontend into develop
* Mindplot module script correction
* Pull branch develop remote
* Webcomponent module webpack correction
* Pull branch develop
* Material-ui library correction and cypress test correction
* Script correction
* Cypress test correction
This commit is contained in:
Ezequiel Vega 2021-10-02 16:16:20 +00:00 committed by Paulo Veiga
parent 5599ea2659
commit 6c5bff906a
10 changed files with 189 additions and 159 deletions

View File

@ -21,7 +21,7 @@
}, },
"scripts": { "scripts": {
"build": "webpack --config webpack.prod.js", "build": "webpack --config webpack.prod.js",
"test": "webpack serve --config webpack.test.js", "tests": "webpack serve --config webpack.test.js",
"start": "webpack serve --config webpack.dev.js" "start": "webpack serve --config webpack.dev.js"
}, },
"dependencies": { "dependencies": {

View File

@ -22,7 +22,7 @@
"scripts": { "scripts": {
"start": "nodemon --watch lib", "start": "nodemon --watch lib",
"build": "webpack --config webpack.prod.js", "build": "webpack --config webpack.prod.js",
"test": "webpack serve --config webpack.test.js" "tests": "webpack serve --config webpack.test.js"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.6", "@babel/core": "^7.14.6",

View File

@ -66,7 +66,7 @@ const CreateDialog = ({ onClose }: CreateProps): React.ReactElement => {
error={error} error={error}
title={intl.formatMessage({ title={intl.formatMessage({
id: 'create.title', id: 'create.title',
defaultMessage: 'Create a new mindmap.', defaultMessage: 'Create a new mindmap',
})} })}
description={intl.formatMessage({ description={intl.formatMessage({
id: 'create.description', id: 'create.description',

View File

@ -67,7 +67,10 @@ const MapsPage = (): ReactElement => {
const intl = useIntl(); const intl = useIntl();
useEffect(() => { useEffect(() => {
document.title = intl.formatMessage({ id: 'maps.page-title', defaultMessage: 'My Maps | WiseMapping' }); document.title = intl.formatMessage({
id: 'maps.page-title',
defaultMessage: 'My Maps | WiseMapping',
});
}, []); }, []);
const mutation = useMutation((id: number) => client.deleteLabel(id), { const mutation = useMutation((id: number) => client.deleteLabel(id), {
@ -219,8 +222,9 @@ const MapsPage = (): ReactElement => {
</div> </div>
<List component="nav"> <List component="nav">
{filterButtons.map(buttonInfo => { {filterButtons.map((buttonInfo) => {
return (<StyleListItem return (
<StyleListItem
icon={buttonInfo.icon} icon={buttonInfo.icon}
label={buttonInfo.label} label={buttonInfo.label}
filter={buttonInfo.filter} filter={buttonInfo.filter}
@ -228,9 +232,9 @@ const MapsPage = (): ReactElement => {
onClick={handleMenuClick} onClick={handleMenuClick}
onDelete={handleLabelDelete} onDelete={handleLabelDelete}
key={`${buttonInfo.filter.type}:${buttonInfo.label}`} key={`${buttonInfo.filter.type}:${buttonInfo.label}`}
/>) />
} );
)} })}
</List> </List>
<div <div

View File

@ -95,15 +95,8 @@ interface EnhancedTableProps {
function EnhancedTableHead(props: EnhancedTableProps) { function EnhancedTableHead(props: EnhancedTableProps) {
const intl = useIntl(); const intl = useIntl();
const { const { classes, onSelectAllClick, order, orderBy, numSelected, rowCount, onRequestSort } =
classes, props;
onSelectAllClick,
order,
orderBy,
numSelected,
rowCount,
onRequestSort,
} = props;
const createSortHandler = (property: keyof MapInfo) => (event: React.MouseEvent<unknown>) => { const createSortHandler = (property: keyof MapInfo) => (event: React.MouseEvent<unknown>) => {
onRequestSort(event, property); onRequestSort(event, property);
@ -117,7 +110,7 @@ function EnhancedTableHead(props: EnhancedTableProps) {
}, },
{ {
id: 'labels', id: 'labels',
numeric: false numeric: false,
}, },
{ {
id: 'createdBy', id: 'createdBy',
@ -222,7 +215,8 @@ const mapsFilter = (filter: Filter, search: string): ((mapInfo: MapInfo) => bool
break; break;
case 'label': case 'label':
result = result =
!mapInfo.labels || mapInfo.labels.some((label) => label.id === (filter as LabelFilter).label.id) !mapInfo.labels ||
mapInfo.labels.some((label) => label.id === (filter as LabelFilter).label.id);
break; break;
case 'public': case 'public':
result = mapInfo.isPublic; result = mapInfo.isPublic;
@ -336,19 +330,18 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
event.stopPropagation(); event.stopPropagation();
}; };
}; };
9 9;
const starredMultation = useMutation<void, ErrorInfo, number>( const starredMultation = useMutation<void, ErrorInfo, number>(
(id: number) => { (id: number) => {
const map = mapsInfo.find((m) => m.id == id); const map = mapsInfo.find((m) => m.id == id);
const starred = !(map?.starred); const starred = !map?.starred;
// Follow a optimistic update approach ... // Follow a optimistic update approach ...
queryClient.setQueryData<MapInfo[]>('maps', mapsInfo => { queryClient.setQueryData<MapInfo[]>('maps', (mapsInfo) => {
if (map) { if (map) {
map.starred = starred; map.starred = starred;
} }
return mapsInfo || []; return mapsInfo || [];
}); });
return client.updateStarred(id, starred); return client.updateStarred(id, starred);
}, },
@ -404,7 +397,13 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
<Toolbar className={classes.toolbar} variant="dense"> <Toolbar className={classes.toolbar} variant="dense">
<div className={classes.toolbarActions}> <div className={classes.toolbarActions}>
{selected.length > 0 && ( {selected.length > 0 && (
<Tooltip arrow={true} title={intl.formatMessage({ id: 'map.delete-selected', defaultMessage: 'Delete selected' })}> <Tooltip
arrow={true}
title={intl.formatMessage({
id: 'map.delete-selected',
defaultMessage: 'Delete selected',
})}
>
<Button <Button
color="primary" color="primary"
size="medium" size="medium"
@ -429,8 +428,8 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
rowsPerPageOptions={[]} rowsPerPageOptions={[]}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}
page={page} page={page}
onChangePage={handleChangePage} onPageChange={handleChangePage}
onChangeRowsPerPage={handleChangeRowsPerPage} onRowsPerPageChange={handleChangeRowsPerPage}
component="div" component="div"
/> />
@ -439,7 +438,10 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
<SearchIcon /> <SearchIcon />
</div> </div>
<InputBase <InputBase
placeholder={intl.formatMessage({ id: 'maps.search-action', defaultMessage: 'Search ...' })} placeholder={intl.formatMessage({
id: 'maps.search-action',
defaultMessage: 'Search ...',
})}
classes={{ classes={{
root: classes.searchInputRoot, root: classes.searchInputRoot,
input: classes.searchInputInput, input: classes.searchInputInput,
@ -512,7 +514,13 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
padding="checkbox" padding="checkbox"
className={classes.bodyCell} className={classes.bodyCell}
> >
<Tooltip arrow={true} title={intl.formatMessage({ id: 'maps.tooltip-starred', defaultMessage: 'Starred' })}> <Tooltip
arrow={true}
title={intl.formatMessage({
id: 'maps.tooltip-starred',
defaultMessage: 'Starred',
})}
>
<IconButton <IconButton
size="small" size="small"
onClick={(e) => onClick={(e) =>
@ -534,7 +542,10 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
<TableCell className={classes.bodyCell}> <TableCell className={classes.bodyCell}>
<Tooltip <Tooltip
arrow={true} arrow={true}
title={intl.formatMessage({ id: 'maps.tooltip-open', defaultMessage: 'Open for edition' })} title={intl.formatMessage({
id: 'maps.tooltip-open',
defaultMessage: 'Open for edition',
})}
placement="bottom-start" placement="bottom-start"
> >
<Link <Link
@ -559,7 +570,19 @@ export const MapsList = (props: MapsListProps): React.ReactElement => {
<TableCell className={classes.bodyCell}> <TableCell className={classes.bodyCell}>
<Tooltip <Tooltip
arrow={true} arrow={true}
title={intl.formatMessage({ id: 'maps.modified-by-desc', defaultMessage: 'Modified by {by} on {on}' }, { by: row.lastModificationBy, on: dayjs(row.lastModificationTime).format('lll') })} title={intl.formatMessage(
{
id: 'maps.modified-by-desc',
defaultMessage:
'Modified by {by} on {on}',
},
{
by: row.lastModificationBy,
on: dayjs(
row.lastModificationTime
).format('lll'),
}
)}
placement="bottom-start" placement="bottom-start"
> >
<span> <span>

View File

@ -1,5 +1,5 @@
import { fade } from '@material-ui/core/styles'; import { fade } from '@material-ui/core/styles';
import { Theme } from '@material-ui/core/styles/createMuiTheme'; import { Theme } from '@material-ui/core/styles/createTheme';
import createStyles from '@material-ui/core/styles/createStyles'; import createStyles from '@material-ui/core/styles/createStyles';
import makeStyles from '@material-ui/core/styles/makeStyles'; import makeStyles from '@material-ui/core/styles/makeStyles';

View File

@ -1,4 +1,4 @@
import { Theme } from '@material-ui/core/styles/createMuiTheme'; import { Theme } from '@material-ui/core/styles/createTheme';
import createStyles from '@material-ui/core/styles/createStyles'; import createStyles from '@material-ui/core/styles/createStyles';
import makeStyles from '@material-ui/core/styles/makeStyles'; import makeStyles from '@material-ui/core/styles/makeStyles';
@ -27,11 +27,11 @@ export const useStyles = makeStyles((theme: Theme) =>
}, },
newMapButton: { newMapButton: {
marginRight: 10, marginRight: 10,
minWidth: '130px' minWidth: '130px',
}, },
importButton: { importButton: {
marginRight: 10, marginRight: 10,
minWidth: '130px' minWidth: '130px',
}, },
rightButtonGroup: { rightButtonGroup: {
marginRight: 10, marginRight: 10,

View File

@ -1,4 +1,4 @@
import createMuiTheme from '@material-ui/core/styles/createMuiTheme'; import createMuiTheme from '@material-ui/core/styles/createTheme';
const theme = createMuiTheme({ const theme = createMuiTheme({
overrides: { overrides: {
@ -7,7 +7,7 @@ const theme = createMuiTheme({
body: { body: {
backgroundColor: 'white', backgroundColor: 'white',
// Important: This size is the min to diplay all pages except maps list. // Important: This size is the min to diplay all pages except maps list.
minWidth: '450px' minWidth: '450px',
}, },
}, },
}, },
@ -29,8 +29,8 @@ const theme = createMuiTheme({
color: '#f9a826', color: '#f9a826',
}, },
outlined: { outlined: {
zIndex: 'inherit' zIndex: 'inherit',
} },
}, },
MuiButton: { MuiButton: {
root: { root: {
@ -47,7 +47,7 @@ const theme = createMuiTheme({
'&:hover': { '&:hover': {
backgroundColor: 'rgba(249, 168, 38, 0.91)', backgroundColor: 'rgba(249, 168, 38, 0.91)',
}, },
} },
}, },
}, },
typography: { typography: {

View File

@ -0,0 +1,3 @@
lib/
node_module/