Skip to content

Commit

Permalink
[hotfix]: fix all the bugs that introduced in the previous release (#317
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sijav authored Oct 28, 2024
1 parent 98c5b74 commit 281ec49
Show file tree
Hide file tree
Showing 27 changed files with 440 additions and 410 deletions.
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"@mui/lab": "^6.0.0-beta.13",
"@mui/material": "^6.1.5",
"@mui/system": "^6.1.5",
"@mui/x-charts": "^7.21.0",
"@mui/x-charts-pro": "^7.0.0-beta.5",
"@mui/x-data-grid-premium": "^7.21.0",
"@mui/x-date-pickers-pro": "^7.21.0",
"@mui/x-tree-view": "^7.21.0",
"@mui/x-charts": "^7.22.0",
"@mui/x-charts-pro": "^7.0.0-beta.6",
"@mui/x-data-grid-premium": "^7.22.0",
"@mui/x-date-pickers-pro": "^7.22.0",
"@mui/x-tree-view": "^7.22.0",
"@tanstack/react-query": "^5.59.16",
"@uidotdev/usehooks": "^2.4.1",
"axios": "^1.7.7",
Expand All @@ -61,7 +61,7 @@
"js-cookie": "^3.0.5",
"lowlight": "^3.1.0",
"mustache": "^4.2.0",
"posthog-js": "^1.175.0",
"posthog-js": "^1.176.0",
"qrcode": "^1.5.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand All @@ -70,7 +70,7 @@
"react-router-dom": "^6.27.0",
"react-transition-group": "^4.4.5",
"react-window": "^1.8.10",
"recharts": "^2.13.0",
"recharts": "~2.12.7",
"trackjs": "^3.10.4",
"typescript-parsec": "^0.3.4",
"yaml": "^2.6.0"
Expand Down Expand Up @@ -101,14 +101,14 @@
"@types/react-lazy-load-image-component": "^1.6.4",
"@types/react-window": "^1.8.8",
"@vitejs/plugin-react-swc": "^3.7.1",
"@vitest/coverage-v8": "^2.1.3",
"@vitest/ui": "^2.1.3",
"@vitest/coverage-v8": "^2.1.4",
"@vitest/ui": "^2.1.4",
"babel-plugin-macros": "3.1.0",
"esbuild": "^0.24.0",
"eslint": "^9.13.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.13",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-storybook": "^0.10.1",
"globals": "^15.11.0",
"husky": "^9.1.6",
Expand All @@ -124,12 +124,12 @@
"typescript": "^5.6.3",
"typescript-eslint": "^8.11.0",
"unique-names-generator": "^4.7.1",
"uuid": "^10.0.0",
"uuid": "^11.0.1",
"vite": "^5.4.10",
"vite-plugin-html": "^3.2.2",
"vite-plugin-mock-dev-server": "^1.8.0",
"vite-plugin-svgr": "^4.2.0",
"vitest": "^2.1.3",
"vitest": "^2.1.4",
"web-vitals": "^4.2.4"
},
"browserslist": {
Expand Down
41 changes: 0 additions & 41 deletions src/containers/panel-settings/PanelSettingsRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,38 +68,6 @@ const WorkspaceSettingsBillingPage = lazy(
),
)

const WorkspaceSettingsAccountsCloudSetupPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud" */
'src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage'
),
)

const WorkspaceSettingsAccountsSetupCloudAWSPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-aws" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-aws/WorkspaceSettingsAccountsSetupCloudAWSPage'
),
)

const WorkspaceSettingsAccountsSetupCloudGCPPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-gcp" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPPage'
),
)

const WorkspaceSettingsAccountsSetupCloudAzurePage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-azure" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-azure/WorkspaceSettingsAccountsSetupCloudAzurePage'
),
)

const WorkspaceUsersSettingsPage = lazy(
() =>
import(
Expand Down Expand Up @@ -135,15 +103,6 @@ export function PanelSettingsRoutes() {
</Route>
<Route path="connected-services" element={<WorkspaceSettingsConnectedServicesPage />} />
<Route path="alert-settings" element={<WorkspaceSettingsAlertSettingsPage />} />
<Route path="accounts">
<Route path="setup-cloud">
<Route index element={<WorkspaceSettingsAccountsCloudSetupPage />} />
<Route path="aws" element={<WorkspaceSettingsAccountsSetupCloudAWSPage />} />
<Route path="gcp" element={<WorkspaceSettingsAccountsSetupCloudGCPPage />} />
<Route path="azure" element={<WorkspaceSettingsAccountsSetupCloudAzurePage />} />
<Route path="*" element={<Navigate to=".." replace />} />
</Route>
</Route>
</Route>
</Route>
<Route path="workspace-users">
Expand Down
43 changes: 43 additions & 0 deletions src/containers/panel/PanelRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,38 @@ const ResourceDetailView = lazy(
),
)

const WorkspaceSettingsAccountsCloudSetupPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud" */
'src/pages/panel/workspace-settings-accounts-setup-cloud/WorkspaceSettingsAccountsSetupCloudPage'
),
)

const WorkspaceSettingsAccountsSetupCloudAWSPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-aws" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-aws/WorkspaceSettingsAccountsSetupCloudAWSPage'
),
)

const WorkspaceSettingsAccountsSetupCloudGCPPage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-gcp" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-gcp/WorkspaceSettingsAccountsSetupCloudGCPPage'
),
)

const WorkspaceSettingsAccountsSetupCloudAzurePage = lazy(
() =>
import(
/* webpackChunkName: "workspace-settings-accounts-setup-cloud-azure" */
'src/pages/panel/workspace-settings-accounts-setup-cloud-azure/WorkspaceSettingsAccountsSetupCloudAzurePage'
),
)

export function PanelRoutes() {
const withResourceDetailRoute = <Route path="resource-detail/:resourceDetailId" element={<ResourceDetailView />} />
return (
Expand Down Expand Up @@ -108,6 +140,17 @@ export function PanelRoutes() {
<Route path="accounts" element={<AccountsPage />} />
</Route>
</Route>
<Route element={<PermissionCheckGuard permissionToCheck="readSettings" />}>
<Route path="accounts">
<Route path="setup-cloud">
<Route index element={<WorkspaceSettingsAccountsCloudSetupPage />} />
<Route path="aws" element={<WorkspaceSettingsAccountsSetupCloudAWSPage />} />
<Route path="gcp" element={<WorkspaceSettingsAccountsSetupCloudGCPPage />} />
<Route path="azure" element={<WorkspaceSettingsAccountsSetupCloudAzurePage />} />
<Route path="*" element={<Navigate to=".." replace />} />
</Route>
</Route>
</Route>
<Route path="settings/*" element={<PanelSettingsContainer />} />
<Route path="*" element={<Navigate to={panelUI.homePage} replace />} />
</Route>
Expand Down
20 changes: 20 additions & 0 deletions src/core/snackbar/SnackbarContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { AlertColor, AlertProps as MuiAlertProps, SnackbarProps as MuiSnackbarProps, SnackbarOrigin, TypographyProps } from '@mui/material'
import { createContext, ReactNode } from 'react'

export interface SnackbarOptions {
snackbarProps: Omit<MuiSnackbarProps, 'open' | 'onClose' | 'autoHideDuration' | 'anchorOrigin'>
alertProps: Omit<MuiAlertProps, 'onClose' | 'severity'>
autoHideDuration: number | null
typographyProps: TypographyProps
alertColor: AlertColor | undefined
bgcolor: TypographyProps['color']
textColor: TypographyProps['color']
anchorOrigin: SnackbarOrigin
}

export interface SnackbarContextValue {
showSnackbar: (message: ReactNode, options?: Partial<SnackbarOptions>) => Promise<number>
closeSnackbar: (key: number) => Promise<boolean>
}

export const SnackbarContext = createContext<SnackbarContextValue | null>(null)
34 changes: 3 additions & 31 deletions src/core/snackbar/SnackbarProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
import {
Alert,
AlertColor,
AlertProps as MuiAlertProps,
Snackbar as MuiSnackbar,
SnackbarProps as MuiSnackbarProps,
Slide,
SnackbarOrigin,
styled,
Typography,
TypographyProps,
useTheme,
} from '@mui/material'
import { createContext, PropsWithChildren, ReactNode, SyntheticEvent, useCallback, useMemo, useState } from 'react'
import { Alert, Snackbar as MuiSnackbar, Slide, styled, Typography, useTheme } from '@mui/material'
import { PropsWithChildren, ReactNode, SyntheticEvent, useCallback, useMemo, useState } from 'react'
import { panelUI } from 'src/shared/constants'
import { shouldForwardPropWithBlackList } from 'src/shared/utils/shouldForwardProp'

interface SnackbarOptions {
snackbarProps: Omit<MuiSnackbarProps, 'open' | 'onClose' | 'autoHideDuration' | 'anchorOrigin'>
alertProps: Omit<MuiAlertProps, 'onClose' | 'severity'>
autoHideDuration: number | null
typographyProps: TypographyProps
alertColor: AlertColor | undefined
bgcolor: TypographyProps['color']
textColor: TypographyProps['color']
anchorOrigin: SnackbarOrigin
}
import { SnackbarContext, SnackbarOptions } from './SnackbarContext'

const DEFAULT_SNACKBAR_OPTIONS: SnackbarOptions = {
snackbarProps: {},
Expand All @@ -43,12 +21,6 @@ export interface SnackbarValue {
options: SnackbarOptions
}

export interface SnackbarContextValue {
showSnackbar: (message: ReactNode, options?: Partial<SnackbarOptions>) => Promise<number>
closeSnackbar: (key: number) => Promise<boolean>
}
export const SnackbarContext = createContext<SnackbarContextValue | null>(null)

const Snackbar = styled(MuiSnackbar, { shouldForwardProp: shouldForwardPropWithBlackList(['index']) })<{ index: number }>(
({ theme, index }) => ({
paddingBottom: 54 * index,
Expand Down
6 changes: 4 additions & 2 deletions src/core/snackbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { SnackbarContext, SnackbarElement, SnackbarProvider } from './SnackbarProvider'
export type { SnackbarContextValue, SnackbarValue } from './SnackbarProvider'
export { SnackbarContext } from './SnackbarContext'
export type { SnackbarContextValue, SnackbarOptions } from './SnackbarContext'
export { SnackbarElement, SnackbarProvider } from './SnackbarProvider'
export type { SnackbarValue } from './SnackbarProvider'
export { useSnackbar } from './useSnackbar'
2 changes: 1 addition & 1 deletion src/core/snackbar/useSnackbar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useContext } from 'react'
import { SnackbarContext, SnackbarContextValue } from './SnackbarProvider'
import { SnackbarContext, SnackbarContextValue } from './SnackbarContext'

export function useSnackbar(): SnackbarContextValue {
const context = useContext(SnackbarContext)
Expand Down
25 changes: 13 additions & 12 deletions src/core/theme/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,23 +300,16 @@ export function Theme({ children, emotionCache }: ThemeProps) {
boxShadow: 'none !important',
},
textSecondary: {
[`&.${buttonClasses.colorPrimary}`]: {
backgroundColor: panelUI.uiThemePalette.background.bgPurple,
':hover,:focus,:active': {
backgroundColor: panelUI.uiThemePalette.accent.purple,
color: panelUI.uiThemePalette.primary.white,
},
},
color: panelUI.uiThemePalette.text.sub,
backgroundColor: panelUI.uiThemePalette.background.bgPurple,
':hover,:focus,:active': {
backgroundColor: panelUI.uiThemePalette.accent.purple,
color: panelUI.uiThemePalette.primary.white,
},
color: panelUI.uiThemePalette.text.sub,
},
textPrimary: {
[`&.${buttonClasses.colorPrimary}`]: {
':hover,:focus,:active': {
backgroundColor: panelUI.uiThemePalette.background.bgPurple,
},
':hover,:focus,:active': {
backgroundColor: panelUI.uiThemePalette.background.bgPurple,
},
},
},
Expand Down Expand Up @@ -349,10 +342,18 @@ export function Theme({ children, emotionCache }: ThemeProps) {
},
},
},
MuiCard: {
styleOverrides: {
root: {
backgroundColor: panelUI.uiThemePalette.primary.white,
},
},
},
MuiTableCell: {
styleOverrides: {
root: {
borderColor: panelUI.uiThemePalette.primary.divider,
backgroundColor: panelUI.uiThemePalette.primary.white,
...typography.subtitle1,
},
head: {
Expand Down
Loading

0 comments on commit 281ec49

Please sign in to comment.