Skip to content

Commit b53937b

Browse files
authored
Merge pull request #1224 from layer5io/chore/switch-mui-datables-projects
mui-datatables provider swap
2 parents 84620c2 + 7f86a40 commit b53937b

22 files changed

Lines changed: 164 additions & 151 deletions

File tree

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"jest": "^29.7.0",
6969
"jest-environment-jsdom": "^29.7.0",
7070
"lint-staged": "^15.5.0",
71-
"mui-datatables": "^4.3.0",
71+
"@sistent/mui-datatables": "^5.0.0",
7272
"notistack": "^3.0.2",
7373
"prettier": "^3.5.3",
7474
"prettier-plugin-organize-imports": "^4.1.0",

src/__testing__/routing.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { RESOURCE_TYPE } from '../constants/constants';
12
import {
23
catalogPath,
34
emptyViewPath,
@@ -7,7 +8,6 @@ import {
78
getShareableResourceRoute,
89
viewPath
910
} from '../utils/routing';
10-
import { RESOURCE_TYPE } from '../constants/constants';
1111

1212
const setLocation = (path: string) => {
1313
window.history.pushState({}, '', path);

src/actors/utils.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,32 @@ export const forwardToActors = (actorSystemIds: string[]) =>
4242

4343
export const deadLetter = (event: AnyEventObject) => ({ type: 'DEAD_LETTER', event });
4444

45-
46-
4745
function isInWorker() {
4846
return (
49-
typeof self !== 'undefined' && // 'self' exists
50-
typeof self?.document === 'undefined' // no Window in worker
47+
typeof self !== 'undefined' && // 'self' exists
48+
typeof self?.document === 'undefined' // no Window in worker
5149
);
5250
}
5351

54-
export const reply = (eventFn: (actionArgs: any, params: any) => AnyEventObject) => enqueueActions(({ enqueue, ...actionArgs }, params) => {
55-
52+
export const reply = (eventFn: (actionArgs: any, params: any) => AnyEventObject) =>
53+
enqueueActions(({ enqueue, ...actionArgs }, params) => {
5654
if (!actionArgs.context.returnAddress) {
57-
console.warn('No return address specified in context for reply action');
58-
return;
55+
console.warn('No return address specified in context for reply action');
56+
return;
5957
}
60-
if (isInWorker()) {
61-
console.log('reply in worker - posting message to main thread', actionArgs.context.returnAddress, eventFn(actionArgs, params));
62-
postMessage(workerEvents.proxyEvent(eventFn(actionArgs, params), actionArgs.context.returnAddress));
63-
return;
64-
}
65-
enqueue.sendTo(actionArgs.context.returnAddress, eventFn);
66-
})
58+
if (isInWorker()) {
59+
console.log(
60+
'reply in worker - posting message to main thread',
61+
actionArgs.context.returnAddress,
62+
eventFn(actionArgs, params)
63+
);
64+
postMessage(
65+
workerEvents.proxyEvent(eventFn(actionArgs, params), actionArgs.context.returnAddress)
66+
);
67+
return;
68+
}
69+
enqueue.sendTo(actionArgs.context.returnAddress, eventFn);
70+
});
6771

6872
export const XSTATE_DEBUG_EVENT = 'XSTATE_DEBUG_EVENT';
6973

src/actors/worker/fromWorkerfiedActor.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ export const fromWorkerfiedActor = (
3535
worker: Worker
3636
): WorkerActorLogic<EventObject, WorkerInput> => ({
3737
config: Worker,
38-
39-
40-
4138

4239
start: (state, actorScope) => {
4340
const { self, system } = actorScope;
@@ -49,7 +46,12 @@ export const fromWorkerfiedActor = (
4946
};
5047

5148
worker.addEventListener('message', (event) => {
52-
console.log('Message received from worker --> ', event,event.data.type == WORKER_EVENTS.PROXY_EVENT,WORKER_EVENTS.PROXY_EVENT);
49+
console.log(
50+
'Message received from worker --> ',
51+
event,
52+
event.data.type == WORKER_EVENTS.PROXY_EVENT,
53+
WORKER_EVENTS.PROXY_EVENT
54+
);
5355
const eventPayload = event.data;
5456
if (eventPayload.type === WORKER_EVENTS.STATE_SNAPSHOT) {
5557
const eventFromWorker = eventPayload as STATE_SNAPSHOT_EVENT;
@@ -58,30 +60,25 @@ export const fromWorkerfiedActor = (
5860
}
5961

6062
if (eventPayload.type === WORKER_EVENTS.PROXY_EVENT) {
61-
6263
const proxyEvent = eventPayload as ProxyEvent;
6364
const targetActorId = proxyEvent.data.to;
6465
const targetEvent = proxyEvent.data.event;
6566
const isToParent = targetActorId === 'parent';
6667
console.log('Proxy event received from worker to', targetActorId, targetEvent, isToParent);
6768

68-
6969
if (isToParent && self._parent) {
7070
console.log('Relaying to parent', proxyEvent.data);
7171
self._parent.send(proxyEvent.data.event);
7272
return state;
7373
}
7474
if (!isToParent) {
7575
const targetActor = system.get(proxyEvent.data.to);
76-
console.log('Relaying to system actor', proxyEvent.data, targetActor,system,self);
77-
if (targetActor){
76+
console.log('Relaying to system actor', proxyEvent.data, targetActor, system, self);
77+
if (targetActor) {
7878
targetActor.send(proxyEvent.data.event);
7979
}
8080
return state;
8181
}
82-
83-
84-
8582
}
8683
});
8784

@@ -103,8 +100,6 @@ export const fromWorkerfiedActor = (
103100
};
104101
}
105102

106-
107-
108103
if (event.type == WORKER_EVENTS.STATE_SNAPSHOT) {
109104
const snapshot = (event as STATE_SNAPSHOT_EVENT).data.snapshot as AnyMachineSnapshot;
110105
return {

src/actors/worker/workerfy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const ProxyActor = setup({
2626
on: {
2727
'*': {
2828
actions: [
29-
({ event, context }) => console.log('Proxying actor event', event, 'to', context.proxyToId),
29+
({ event, context }) =>
30+
console.log('Proxying actor event', event, 'to', context.proxyToId),
3031
({ event, context }) => postMessage(workerEvents.proxyEvent(event, context.proxyToId))
3132
]
3233
}

src/custom/CustomCatalog/style.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ export const StyledInnerClassWrapper = styled('div')<StyledInnerClassWrapperProp
5353
}) => {
5454
const mapToColor: Record<string, string> = {
5555
community: theme.palette.catalogStatus?.community,
56-
official:
57-
theme.palette.catalogStatus?.official,
58-
verified:
59-
theme.palette.catalogStatus?.verified
56+
official: theme.palette.catalogStatus?.official,
57+
verified: theme.palette.catalogStatus?.verified
6058
};
6159
return {
6260
font: 'bold 10px sans-serif',

src/custom/CustomTooltip/customTooltip.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { alpha, useTheme } from '@mui/material';
2+
import type { Theme } from '@mui/material/styles';
13
import _ from 'lodash';
24
import React from 'react';
3-
import type { Theme } from '@mui/material/styles';
4-
import { alpha, useTheme } from '@mui/material';
55
import { Tooltip, TooltipProps } from '../../base';
66
import { WHITE } from '../../theme';
77
import { RenderMarkdownTooltip } from '../Markdown';
@@ -50,7 +50,6 @@ function CustomTooltip({
5050
boxShadow: (themeArg?: Theme) => {
5151
const t = themeArg || theme;
5252
const isDefaultTheme = t.palette.primary.main === '#1976d2';
53-
console.log(isDefaultTheme)
5453

5554
if (t?.palette?.mode === 'light' && !isDefaultTheme) {
5655
return 'rgba(0, 0, 0, 0.6) 0px 4px 10px, rgba(0, 0, 0, 0.5) 0px 2px 4px';
@@ -60,20 +59,20 @@ function CustomTooltip({
6059
return `0 10px 30px ${alpha(green, 0.28)},
6160
0 2px 8px ${alpha(green, 0.2)},
6261
0 0 1px ${alpha(green, 0.32)}`;
63-
},
64-
},
62+
}
63+
}
6564
},
6665
popper: {
6766
sx: {
6867
zIndex: 9999999999,
69-
opacity: '1',
70-
},
68+
opacity: '1'
69+
}
7170
},
7271
arrow: {
7372
sx: {
74-
color: bgColor,
75-
},
76-
},
73+
color: bgColor
74+
}
75+
}
7776
},
7877
componentsProps
7978
)}

src/custom/DashboardWidgets/GettingStartedWidget/InviteUserModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default function UserInviteModal({
103103
const orgs = data?.organizations;
104104
const defaultOrgSelection = { id: 'none', name: 'None' };
105105
const [organization, setOrganization] = useState<Organization>(defaultOrgSelection);
106-
106+
107107
// Query to check if user exists by email (only if hook is provided)
108108
const { data: existingUserData } = useGetUserByEmailQuery?.(
109109
{ email: inviteeEmail },

src/custom/DashboardWidgets/PlainCard.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ResourceListItem = styled('li')(({ theme }) => ({
2929
flexDirection: 'row',
3030
alignItems: 'center',
3131
gap: '0.25rem',
32-
32+
3333
'&:hover': {
3434
color: theme.palette.primary.main
3535
}
@@ -75,9 +75,7 @@ export const PlainCard = ({ title, icon, resources }: PlainCardProps): JSX.Eleme
7575
<StyledResourceList>
7676
{resources.map((item) => (
7777
<ResourceListItem key={item.link}>
78-
<Box sx={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>
79-
{item.icon}
80-
</Box>
78+
<Box sx={{ flexShrink: 0, display: 'flex', alignItems: 'center' }}>{item.icon}</Box>
8179

8280
<StyledResourceLink
8381
href={item.link}
@@ -89,11 +87,7 @@ export const PlainCard = ({ title, icon, resources }: PlainCardProps): JSX.Eleme
8987

9088
{item.external && (
9189
<sup>
92-
<OpenInNewIcon
93-
width="12px"
94-
height="12px"
95-
fill="currentColor"
96-
/>
90+
<OpenInNewIcon width="12px" height="12px" fill="currentColor" />
9791
</sup>
9892
)}
9993
</ResourceListItem>

0 commit comments

Comments
 (0)