Skip to content

Commit ebb0ff1

Browse files
authored
Merge branch 'master' into add-permission
2 parents 0615e4a + 6362567 commit ebb0ff1

File tree

10 files changed

+49
-14
lines changed

10 files changed

+49
-14
lines changed

src/custom/ResourceDetailFormatters/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
TextWithLinkFormatter
1616
} from './Formatter';
1717
import { useResourceCleanData } from './useResourceCleanData';
18-
import { extractPodVolumnTables, splitCamelCaseString } from './utils';
18+
import { convertToReadableUnit, extractPodVolumnTables, splitCamelCaseString } from './utils';
1919

2020
export {
2121
CodeFormatter,
@@ -33,6 +33,7 @@ export {
3333
StatusFormatter,
3434
TableDataFormatter,
3535
TextWithLinkFormatter,
36+
convertToReadableUnit,
3637
extractPodVolumnTables,
3738
splitCamelCaseString,
3839
useResourceCleanData

src/custom/ResourceDetailFormatters/utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,17 @@ export function isEmptyAtAllDepths(input: any): boolean {
8989
return _.isEmpty(input);
9090
}
9191
}
92+
93+
export const convertToReadableUnit = (value: number): string => {
94+
if (!value) return '0';
95+
96+
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];
97+
let index = 0;
98+
99+
while (value >= 1024 && index < units.length - 1) {
100+
value /= 1024;
101+
index++;
102+
}
103+
104+
return `${value.toFixed(2)} ${units[index]}`;
105+
};

src/theme/components/appbar.modifiter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ export const MuiAppBar: Components<Theme>['MuiAppBar'] = {
66
const {
77
palette: {
88
background: { default: defaultBackground }
9-
}
9+
},
10+
typography: { fontFamily }
1011
} = theme;
1112
return {
13+
fontFamily,
1214
elevation: 2,
1315
background: defaultBackground
1416
};

src/theme/components/buttongroup.modifier.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { Components, Theme } from '@mui/material';
33
export const MuiButtonGroup: Components<Theme>['MuiButtonGroup'] = {
44
styleOverrides: {
55
grouped: ({ theme }) => ({
6-
borderColor: theme.palette.common.white
6+
borderColor: theme.palette.common.white,
7+
fontFamily: theme.typography.fontFamily
78
})
89
}
910
};

src/theme/components/link.modifier.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ export const MuiLink: Components<Theme>['MuiLink'] = {
77
palette: {
88
text: { default: defaultText },
99
background: { brand }
10-
}
10+
},
11+
typography: { fontFamily }
1112
} = theme;
1213
return {
14+
fontFamily: fontFamily,
1315
fontWeight: '600',
1416
textDecoration: 'none',
1517
color: defaultText,

src/theme/components/listitem.modifier.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export const MuiListItem: Components<Theme>['MuiListItem'] = {
2020
text: { default: defaultText },
2121
icon: { default: defaultIcon },
2222
background: { brand }
23-
}
23+
},
24+
typography: { fontFamily }
2425
} = theme;
2526
return {
27+
fontFamily,
2628
textTransform: 'none',
2729
margin: '.5rem 0rem .5rem .5rem',
2830
padding: '0rem',

src/theme/components/menu.modifier.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@ import { Components, Theme } from '@mui/material';
22

33
export const MuiMenu: Components<Theme>['MuiMenu'] = {
44
styleOverrides: {
5-
paper: {
6-
'& .MuiMenuItem-root.Mui-selected': {
7-
backgroundColor: 'rgba(0, 0, 0, 0.08)',
8-
'&:hover': {
9-
backgroundColor: 'rgba(0, 0, 0, 0.08)'
5+
root: ({ theme }) => {
6+
const {
7+
typography: { fontFamily }
8+
} = theme;
9+
return {
10+
paper: {
11+
fontFamily: fontFamily,
12+
'& .MuiMenuItem-root.Mui-selected': {
13+
backgroundColor: 'rgba(0, 0, 0, 0.08)',
14+
'&:hover': {
15+
backgroundColor: 'rgba(0, 0, 0, 0.08)'
16+
}
17+
}
1018
}
11-
}
19+
};
1220
}
1321
}
1422
};

src/theme/components/menuitem.modifier.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ export const MuiMenuItem: Components<Theme>['MuiMenuItem'] = {
66
const {
77
palette: {
88
text: { tertiary }
9-
}
9+
},
10+
typography: { fontFamily }
1011
} = theme;
1112
return {
13+
fontFamily: fontFamily,
1214
'&:hover': {
1315
'& li': {
1416
color: tertiary,

src/theme/components/tab.modifier.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ export const MuiTab: Components<Theme>['MuiTab'] = {
77
palette: {
88
text: { default: defaultText },
99
background: { tabs: defaultBackground }
10-
}
10+
},
11+
typography: { textB1Regular }
1112
} = theme;
1213
return {
14+
...textB1Regular,
1315
'&.Mui-selected': {
1416
color: defaultText,
1517
backgroundColor: defaultBackground

src/theme/components/tabs.modifier.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { Components, Theme } from '@mui/material';
33
export const MuiTabs: Components<Theme>['MuiTabs'] = {
44
styleOverrides: {
55
root: ({ theme }) => ({
6-
backgroundColor: theme.palette.background.tabs
6+
backgroundColor: theme.palette.background.tabs,
7+
fontFamily: theme.typography.fontFamily
78
}),
89
indicator: ({ theme }) => ({
910
backgroundColor: theme.palette.background.brand?.default

0 commit comments

Comments
 (0)