Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,8 @@ const AddBucket = ({
{!distributedSetup && (
<Fragment>
<small className={classes.error}>
Some of these features are disabled as server is running in
FS mode. <br />
If you require any of this, please start server in
distributed mode.
Some these features are disabled as server is running in
non-erasure coded mode.
</small>
<br />
<br />
Expand Down
19 changes: 16 additions & 3 deletions portal-ui/src/screens/Console/Heal/Heal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { HorizontalBar } from "react-chartjs-2";
import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import { HorizontalBar } from "react-chartjs-2";
import { Button, Grid, TextField, InputBase } from "@material-ui/core";
import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket";
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
Expand All @@ -33,6 +34,7 @@ import {
} from "../Common/FormComponents/common/styleLibrary";
import CheckboxWrapper from "../Common/FormComponents/CheckboxWrapper/CheckboxWrapper";
import PageHeader from "../Common/PageHeader/PageHeader";
import { AppState } from "../../../store";

const styles = (theme: Theme) =>
createStyles({
Expand Down Expand Up @@ -74,6 +76,7 @@ const styles = (theme: Theme) =>

interface IHeal {
classes: any;
distributedSetup: boolean;
}

const SelectStyled = withStyles((theme: Theme) =>
Expand All @@ -98,7 +101,7 @@ const SelectStyled = withStyles((theme: Theme) =>
})
)(InputBase);

const Heal = ({ classes }: IHeal) => {
const Heal = ({ classes, distributedSetup }: IHeal) => {
const [start, setStart] = useState(false);
const [bucketName, setBucketName] = useState("");
const [bucketList, setBucketList] = useState<Bucket[]>([]);
Expand Down Expand Up @@ -227,6 +230,10 @@ const Heal = ({ classes }: IHeal) => {
label: bucketName.name,
value: bucketName.name,
}));
if (!distributedSetup) {
return null;
}

return (
<React.Fragment>
<PageHeader label="Heal" />
Expand Down Expand Up @@ -355,4 +362,10 @@ const Heal = ({ classes }: IHeal) => {
);
};

export default withStyles(styles)(Heal);
const mapState = (state: AppState) => ({
distributedSetup: state.system.distributedSetup,
});

const connector = connect(mapState, null);

export default connector(withStyles(styles)(Heal));
27 changes: 17 additions & 10 deletions portal-ui/src/screens/Console/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,6 @@ const styles = (theme: Theme) =>
},
});

const mapState = (state: AppState) => ({
open: state.system.loggedIn,
operatorMode: state.system.operatorMode,
});

const connector = connect(mapState, { userLoggedIn });

// Menu State builder for groups
const menuStateBuilder = () => {
let elements: any = [];
Expand All @@ -168,7 +161,13 @@ const menuStateBuilder = () => {
return elements;
};

const Menu = ({ userLoggedIn, classes, pages, operatorMode }: IMenuProps) => {
const Menu = ({
userLoggedIn,
classes,
pages,
operatorMode,
distributedSetup,
}: IMenuProps) => {
const [menuOpen, setMenuOpen] = useState<any>(menuStateBuilder());

const logout = () => {
Expand Down Expand Up @@ -278,6 +277,7 @@ const Menu = ({ userLoggedIn, classes, pages, operatorMode }: IMenuProps) => {
to: "/heal",
name: "Heal",
icon: <HealIcon />,
fsHidden: distributedSetup,
},
{
group: "Tools",
Expand Down Expand Up @@ -386,8 +386,7 @@ const Menu = ({ userLoggedIn, classes, pages, operatorMode }: IMenuProps) => {
}

const allowedItems = menuItems.filter(
(item: any) =>
allowedPages[item.to] || item.forceDisplay || item.type !== "item"
(item: any) => (allowedPages[item.to] || item.forceDisplay || item.type !== "item") && item.fsHidden !== false
);

const setMenuCollapse = (menuClicked: string) => {
Expand Down Expand Up @@ -501,4 +500,12 @@ const Menu = ({ userLoggedIn, classes, pages, operatorMode }: IMenuProps) => {
);
};

const mapState = (state: AppState) => ({
open: state.system.loggedIn,
operatorMode: state.system.operatorMode,
distributedSetup: state.system.distributedSetup,
});

const connector = connect(mapState, { userLoggedIn });

export default connector(withStyles(styles)(Menu));
2 changes: 2 additions & 0 deletions portal-ui/src/screens/Console/Menu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface IMenuProps {
userLoggedIn: typeof userLoggedIn;
pages: string[];
operatorMode: boolean;
distributedSetup: boolean;
}

export interface IMenuItem {
Expand All @@ -33,4 +34,5 @@ export interface IMenuItem {
onClick?: any;
forceDisplay?: boolean;
extraMargin?: boolean;
fsHidden?: boolean;
}