Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(Header): top counters are no longer collapsable (#11717)
Browse files Browse the repository at this point in the history
* first part

* enhancements

* enhancements

* enhancements

* Update www/front_src/src/Header/index.tsx

Co-authored-by: Tom Darneix <tomdar87@outlook.com>

* fix skelton

* fix eslint

Co-authored-by: Tom Darneix <tomdar87@outlook.com>
  • Loading branch information
Noha-ElAbrouki and Thebarda authored Sep 12, 2022
1 parent 84a6afa commit 51930aa
Show file tree
Hide file tree
Showing 8 changed files with 490 additions and 1,933 deletions.
2,364 changes: 457 additions & 1,907 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
"string-argv": "^0.3.1",
"systemjs": "^6.12.1",
"ts.data.json": "^2.1.0",
"tss-react": "^4.1.3",
"use-deep-compare-effect": "^1.8.1",
"yup": "^0.32.11" ,
"tss-react": "^4.1.3"
"yup": "^0.32.11"
},
"jest": {
"testResultsProcessor": "jest-junit",
Expand Down
4 changes: 1 addition & 3 deletions www/front_src/src/Header/PollerMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ const PollerMenu = (): JSX.Element | null => {
clearInterval(interval.current);
};
}, []);
const loaderWidth = 16;
const pollerListIssues =
'internal.php?object=centreon_topcounter&action=pollersListIssues';

Expand Down Expand Up @@ -196,7 +195,7 @@ const PollerMenu = (): JSX.Element | null => {
}

if (isNil(issues)) {
return <MenuSkeleton width={loaderWidth} />;
return <MenuSkeleton />;
}

const redirectToPollerConfiguration = (): void => {
Expand Down Expand Up @@ -225,7 +224,6 @@ const PollerMenu = (): JSX.Element | null => {
<div className={classes.iconToggleMenu}>
<IconToggleSubmenu
data-testid="submenu-poller"
iconType="arrow"
rotate={toggled}
onClick={toggleDetailedView}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const HostStatusCounter = (): JSX.Element => {
return (
<RessourceStatusCounter<HostData>
endpoint={hostStatusEndpoint}
loaderWidth={16}
loaderWidth={12}
schema={statusSchema}
>
{({ hasPending, toggled, toggleDetailedView, data }): JSX.Element => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const ServiceStatusCounter = (): JSX.Element => {
return (
<RessourceStatusCounter
endpoint={serviceStatusEndpoint}
loaderWidth={20}
loaderWidth={14}
schema={statusSchema}
>
{({ hasPending, data, toggled, toggleDetailedView }): JSX.Element => (
Expand Down
32 changes: 23 additions & 9 deletions www/front_src/src/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,32 @@ import UserMenu from './userMenu';
export const isDarkMode = (theme: Theme): boolean =>
equals(theme.palette.mode, ThemeMode.dark);

export const headerHeight = 8;
export const headerHeight = 6;

const useStyles = makeStyles((theme) => ({
container: {
alignItems: 'center',
alignItems: 'flex-end',
display: 'flex',
justifyContent: 'space-between',
margin: theme.spacing(0, 4, 0, 3),
width: '100%',
},
header: {
alignItems: 'center',
backgroundColor: isDarkMode(theme)
? theme.palette.background.default
: theme.palette.primary.main,
display: 'flex',
height: theme.spacing(headerHeight),
paddingBottom: theme.spacing(0.5),
width: '100%',
},
item: {
flex: 1,
maxWidth: theme.spacing(15),
},
leftContainer: {
alignItems: 'center',
alignItems: 'flex-end',
display: 'flex',
flex: 1,
gap: theme.spacing(3),
[theme.breakpoints.down(768)]: {
gap: theme.spacing(2),
Expand All @@ -51,6 +55,8 @@ const useStyles = makeStyles((theme) => ({
userMenuContainer: {
alignItems: 'center',
display: 'flex',
flex: 0.5,
justifyContent: 'flex-end',
},
}));

Expand All @@ -62,10 +68,18 @@ const Header = (): JSX.Element => {
<header className={classes.header} ref={headerRef}>
<div className={classes.container}>
<div className={classes.leftContainer}>
<PollerMenu />
<ServiceStatusCounter />
<HostStatusCounter />
<FederatedComponent path="/bam/header/topCounter" />
<div className={classes.item}>
<PollerMenu />
</div>
<div className={classes.item}>
<ServiceStatusCounter />
</div>
<div className={classes.item}>
<HostStatusCounter />
</div>
<div className={classes.item}>
<FederatedComponent path="/bam/header/topCounter" />
</div>
</div>
<div className={classes.userMenuContainer}>
<UserMenu headerRef={headerRef} />
Expand Down
9 changes: 3 additions & 6 deletions www/front_src/src/Header/userMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ const useStyles = makeStyles((theme) => ({
borderLeft: 'none',
},
},
loaderUserMenu: {
marginRight: theme.spacing(22 / 8),
},
menu: {
backgroundColor: equals(theme.palette.mode, ThemeMode.dark)
? theme.palette.background.default
Expand Down Expand Up @@ -200,14 +197,14 @@ const useStyles = makeStyles((theme) => ({
wrapRightUserItems: {
display: 'flex',
gap: theme.spacing(4),
justifyContent: 'space-between',
width: '100%',
justifyContent: 'flex-end',
[theme.breakpoints.down(1200)]: {
gap: theme.spacing(2.5),
},
[theme.breakpoints.down(900)]: {
gap: theme.spacing(1.5),
},
width: '100%',
},
}));
interface Props {
Expand Down Expand Up @@ -361,7 +358,7 @@ const UserMenu = ({ headerRef }: Props): JSX.Element => {
}, []);

if (!data) {
return <MenuSkeleton className={classes.loaderUserMenu} width={14} />;
return <MenuSkeleton width={24} />;
}

const allowEditProfile = allowedPages?.includes(editProfileTopologyPage);
Expand Down
6 changes: 2 additions & 4 deletions www/front_src/src/federatedModules/Load/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ const LoadComponent = ({

return (
<Suspense
fallback={
isFederatedModule ? <MenuSkeleton width={27} /> : <PageSkeleton />
}
fallback={isFederatedModule ? <MenuSkeleton /> : <PageSkeleton />}
>
<Component {...props} />
</Suspense>
Expand Down Expand Up @@ -124,7 +122,7 @@ export const Remote = ({
});

if (!ready) {
return isFederatedModule ? <MenuSkeleton width={27} /> : <PageSkeleton />;
return isFederatedModule ? <MenuSkeleton /> : <PageSkeleton />;
}

if (failed) {
Expand Down

0 comments on commit 51930aa

Please sign in to comment.