Fix UI to access Support tools if registered (#2624)
This commit is contained in:
@@ -38,3 +38,8 @@ export const getLogoVar = (): LogoVar => {
|
|||||||
}
|
}
|
||||||
return logoVar;
|
return logoVar;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const registeredCluster = (): boolean => {
|
||||||
|
const plan = getLogoVar();
|
||||||
|
return plan === "standard" || plan === "enterprise";
|
||||||
|
};
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import {
|
|||||||
healthInfoResetMessage,
|
healthInfoResetMessage,
|
||||||
} from "./healthInfoSlice";
|
} from "./healthInfoSlice";
|
||||||
import RegisterCluster from "../Support/RegisterCluster";
|
import RegisterCluster from "../Support/RegisterCluster";
|
||||||
|
import { registeredCluster } from "../../../config";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -102,12 +103,7 @@ const HealthInfo = ({ classes }: IHealthInfo) => {
|
|||||||
|
|
||||||
const message = useSelector((state: AppState) => state.healthInfo.message);
|
const message = useSelector((state: AppState) => state.healthInfo.message);
|
||||||
|
|
||||||
const licenseInfo = useSelector(
|
const clusterRegistered = registeredCluster();
|
||||||
(state: AppState) => state?.system?.licenseInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
const { plan = "" } = licenseInfo || {};
|
|
||||||
const registeredCluster = plan === "STANDARD" || plan === "ENTERPRISE";
|
|
||||||
|
|
||||||
const serverDiagnosticStatus = useSelector(
|
const serverDiagnosticStatus = useSelector(
|
||||||
(state: AppState) => state.system.serverDiagnosticStatus
|
(state: AppState) => state.system.serverDiagnosticStatus
|
||||||
@@ -256,7 +252,7 @@ const HealthInfo = ({ classes }: IHealthInfo) => {
|
|||||||
}, [startDiagnostic, dispatch]);
|
}, [startDiagnostic, dispatch]);
|
||||||
|
|
||||||
const startDiagnosticAction = () => {
|
const startDiagnosticAction = () => {
|
||||||
if (plan !== "STANDARD" && plan !== "ENTERPRISE") {
|
if (!clusterRegistered) {
|
||||||
navigate("/support/register");
|
navigate("/support/register");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -267,7 +263,7 @@ const HealthInfo = ({ classes }: IHealthInfo) => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<PageHeader label="Health" />
|
<PageHeader label="Health" />
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
{!registeredCluster && <RegisterCluster compactMode />}
|
{!clusterRegistered && <RegisterCluster compactMode />}
|
||||||
<Grid item xs={12} className={classes.boxy}>
|
<Grid item xs={12} className={classes.boxy}>
|
||||||
<TestWrapper title={title} advancedVisible={false}>
|
<TestWrapper title={title} advancedVisible={false}>
|
||||||
<Grid container className={classes.buttons}>
|
<Grid container className={classes.buttons}>
|
||||||
@@ -305,7 +301,7 @@ const HealthInfo = ({ classes }: IHealthInfo) => {
|
|||||||
<Button
|
<Button
|
||||||
id="start-new-diagnostic"
|
id="start-new-diagnostic"
|
||||||
type="submit"
|
type="submit"
|
||||||
variant={!registeredCluster ? "regular" : "callAction"}
|
variant={!clusterRegistered ? "regular" : "callAction"}
|
||||||
disabled={startDiagnostic}
|
disabled={startDiagnostic}
|
||||||
onClick={startDiagnosticAction}
|
onClick={startDiagnosticAction}
|
||||||
label={buttonStartText}
|
label={buttonStartText}
|
||||||
@@ -317,7 +313,7 @@ const HealthInfo = ({ classes }: IHealthInfo) => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</TestWrapper>
|
</TestWrapper>
|
||||||
</Grid>
|
</Grid>
|
||||||
{!startDiagnostic && registeredCluster && (
|
{!startDiagnostic && clusterRegistered && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<br />
|
<br />
|
||||||
<HelpBox
|
<HelpBox
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import { IMessageEvent, w3cwebsocket as W3CWebSocket } from "websocket";
|
|||||||
import { Grid } from "@mui/material";
|
import { Grid } from "@mui/material";
|
||||||
import { Theme } from "@mui/material/styles";
|
import { Theme } from "@mui/material/styles";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { AppState } from "../../../store";
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
HelpBox,
|
HelpBox,
|
||||||
@@ -54,6 +53,7 @@ import DistributedOnly from "../Common/DistributedOnly/DistributedOnly";
|
|||||||
import { selDistSet } from "../../../systemSlice";
|
import { selDistSet } from "../../../systemSlice";
|
||||||
import makeStyles from "@mui/styles/makeStyles";
|
import makeStyles from "@mui/styles/makeStyles";
|
||||||
import RegisterCluster from "../Support/RegisterCluster";
|
import RegisterCluster from "../Support/RegisterCluster";
|
||||||
|
import { registeredCluster } from "../../../config";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme: Theme) =>
|
const useStyles = makeStyles((theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -85,13 +85,8 @@ const useStyles = makeStyles((theme: Theme) =>
|
|||||||
|
|
||||||
const Speedtest = () => {
|
const Speedtest = () => {
|
||||||
const distributedSetup = useSelector(selDistSet);
|
const distributedSetup = useSelector(selDistSet);
|
||||||
const licenseInfo = useSelector(
|
|
||||||
(state: AppState) => state?.system?.licenseInfo
|
|
||||||
);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const { plan = "" } = licenseInfo || {};
|
const navigate = useNavigate();
|
||||||
const registeredCluster = plan === "STANDARD" || plan === "ENTERPRISE";
|
|
||||||
|
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [start, setStart] = useState<boolean>(false);
|
const [start, setStart] = useState<boolean>(false);
|
||||||
@@ -108,6 +103,7 @@ const Speedtest = () => {
|
|||||||
const [currentValue, setCurrentValue] = useState<number>(0);
|
const [currentValue, setCurrentValue] = useState<number>(0);
|
||||||
const [totalSeconds, setTotalSeconds] = useState<number>(0);
|
const [totalSeconds, setTotalSeconds] = useState<number>(0);
|
||||||
const [speedometerValue, setSpeedometerValue] = useState<number>(0);
|
const [speedometerValue, setSpeedometerValue] = useState<number>(0);
|
||||||
|
const clusterRegistered = registeredCluster();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// begin watch if bucketName in bucketList and start pressed
|
// begin watch if bucketName in bucketList and start pressed
|
||||||
@@ -199,7 +195,7 @@ const Speedtest = () => {
|
|||||||
const buttonLabel = start ? "Start" : stoppedLabel;
|
const buttonLabel = start ? "Start" : stoppedLabel;
|
||||||
|
|
||||||
const startSpeedtestButton = () => {
|
const startSpeedtestButton = () => {
|
||||||
if (plan !== "STANDARD" && plan !== "ENTERPRISE") {
|
if (!clusterRegistered) {
|
||||||
navigate("/support/register");
|
navigate("/support/register");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -212,7 +208,7 @@ const Speedtest = () => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<PageHeader label="Performance" />
|
<PageHeader label="Performance" />
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
{!registeredCluster && <RegisterCluster compactMode />}
|
{!clusterRegistered && <RegisterCluster compactMode />}
|
||||||
{!distributedSetup ? (
|
{!distributedSetup ? (
|
||||||
<DistributedOnly
|
<DistributedOnly
|
||||||
iconComponent={<SpeedtestIcon />}
|
iconComponent={<SpeedtestIcon />}
|
||||||
@@ -313,7 +309,7 @@ const Speedtest = () => {
|
|||||||
type="button"
|
type="button"
|
||||||
id={"start-speed-test"}
|
id={"start-speed-test"}
|
||||||
variant={
|
variant={
|
||||||
registeredCluster && currStatus !== null && !start
|
clusterRegistered && currStatus !== null && !start
|
||||||
? "callAction"
|
? "callAction"
|
||||||
: "regular"
|
: "regular"
|
||||||
}
|
}
|
||||||
@@ -340,7 +336,7 @@ const Speedtest = () => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
{!start && !currStatus && registeredCluster && (
|
{!start && !currStatus && clusterRegistered && (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<br />
|
<br />
|
||||||
<HelpBox
|
<HelpBox
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ import {
|
|||||||
containerForHeader,
|
containerForHeader,
|
||||||
inlineCheckboxes,
|
inlineCheckboxes,
|
||||||
} from "../Common/FormComponents/common/styleLibrary";
|
} from "../Common/FormComponents/common/styleLibrary";
|
||||||
import { useSelector } from "react-redux";
|
|
||||||
import { AppState } from "../../../store";
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import RegisterCluster from "./RegisterCluster";
|
import RegisterCluster from "./RegisterCluster";
|
||||||
|
import { registeredCluster } from "../../../config";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -60,14 +59,8 @@ interface IProfileProps {
|
|||||||
var c: any = null;
|
var c: any = null;
|
||||||
|
|
||||||
const Profile = ({ classes }: IProfileProps) => {
|
const Profile = ({ classes }: IProfileProps) => {
|
||||||
const licenseInfo = useSelector(
|
|
||||||
(state: AppState) => state?.system?.licenseInfo
|
|
||||||
);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { plan = "" } = licenseInfo || {};
|
|
||||||
const registeredCluster = plan === "STANDARD" || plan === "ENTERPRISE";
|
|
||||||
|
|
||||||
const [profilingStarted, setProfilingStarted] = useState<boolean>(false);
|
const [profilingStarted, setProfilingStarted] = useState<boolean>(false);
|
||||||
const [types, setTypes] = useState<string[]>([
|
const [types, setTypes] = useState<string[]>([
|
||||||
"cpu",
|
"cpu",
|
||||||
@@ -76,7 +69,7 @@ const Profile = ({ classes }: IProfileProps) => {
|
|||||||
"mutex",
|
"mutex",
|
||||||
"goroutines",
|
"goroutines",
|
||||||
]);
|
]);
|
||||||
|
const clusterRegistered = registeredCluster();
|
||||||
const typesList = [
|
const typesList = [
|
||||||
{ label: "cpu", value: "cpu" },
|
{ label: "cpu", value: "cpu" },
|
||||||
{ label: "mem", value: "mem" },
|
{ label: "mem", value: "mem" },
|
||||||
@@ -149,7 +142,7 @@ const Profile = ({ classes }: IProfileProps) => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<PageHeader label="Profile" />
|
<PageHeader label="Profile" />
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
{!registeredCluster && <RegisterCluster compactMode />}
|
{!clusterRegistered && <RegisterCluster compactMode />}
|
||||||
<Grid item xs={12} className={classes.boxy}>
|
<Grid item xs={12} className={classes.boxy}>
|
||||||
<Grid item xs={12} className={classes.dropdown}>
|
<Grid item xs={12} className={classes.dropdown}>
|
||||||
<Grid
|
<Grid
|
||||||
@@ -178,10 +171,10 @@ const Profile = ({ classes }: IProfileProps) => {
|
|||||||
<Button
|
<Button
|
||||||
id={"start-profiling"}
|
id={"start-profiling"}
|
||||||
type="submit"
|
type="submit"
|
||||||
variant={registeredCluster ? "callAction" : "regular"}
|
variant={clusterRegistered ? "callAction" : "regular"}
|
||||||
disabled={profilingStarted || types.length < 1}
|
disabled={profilingStarted || types.length < 1}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!registeredCluster) {
|
if (!clusterRegistered) {
|
||||||
navigate("/support/register");
|
navigate("/support/register");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,9 @@ import {
|
|||||||
import DistributedOnly from "../Common/DistributedOnly/DistributedOnly";
|
import DistributedOnly from "../Common/DistributedOnly/DistributedOnly";
|
||||||
import KeyRevealer from "./KeyRevealer";
|
import KeyRevealer from "./KeyRevealer";
|
||||||
import { selDistSet, setErrorSnackMessage } from "../../../systemSlice";
|
import { selDistSet, setErrorSnackMessage } from "../../../systemSlice";
|
||||||
import { AppState, useAppDispatch } from "../../../store";
|
import { useAppDispatch } from "../../../store";
|
||||||
import RegisterCluster from "../Support/RegisterCluster";
|
import RegisterCluster from "../Support/RegisterCluster";
|
||||||
|
import { registeredCluster } from "../../../config";
|
||||||
|
|
||||||
const styles = (theme: Theme) =>
|
const styles = (theme: Theme) =>
|
||||||
createStyles({
|
createStyles({
|
||||||
@@ -100,12 +101,6 @@ const Inspect = ({ classes }: { classes: any }) => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const distributedSetup = useSelector(selDistSet);
|
const distributedSetup = useSelector(selDistSet);
|
||||||
const licenseInfo = useSelector(
|
|
||||||
(state: AppState) => state?.system?.licenseInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
const { plan = "" } = licenseInfo || {};
|
|
||||||
const registeredCluster = plan === "STANDARD" || plan === "ENTERPRISE";
|
|
||||||
|
|
||||||
const [volumeName, setVolumeName] = useState<string>("");
|
const [volumeName, setVolumeName] = useState<string>("");
|
||||||
const [inspectPath, setInspectPath] = useState<string>("");
|
const [inspectPath, setInspectPath] = useState<string>("");
|
||||||
@@ -118,7 +113,7 @@ const Inspect = ({ classes }: { classes: any }) => {
|
|||||||
const [isFormValid, setIsFormValid] = useState<boolean>(false);
|
const [isFormValid, setIsFormValid] = useState<boolean>(false);
|
||||||
const [volumeError, setVolumeError] = useState<string>("");
|
const [volumeError, setVolumeError] = useState<string>("");
|
||||||
const [pathError, setPathError] = useState<string>("");
|
const [pathError, setPathError] = useState<string>("");
|
||||||
|
const clusterRegistered = registeredCluster();
|
||||||
/**
|
/**
|
||||||
* Validation Effect
|
* Validation Effect
|
||||||
*/
|
*/
|
||||||
@@ -205,7 +200,7 @@ const Inspect = ({ classes }: { classes: any }) => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<PageHeader label={"Inspect"} />
|
<PageHeader label={"Inspect"} />
|
||||||
<PageLayout>
|
<PageLayout>
|
||||||
{!registeredCluster && <RegisterCluster compactMode />}
|
{!clusterRegistered && <RegisterCluster compactMode />}
|
||||||
{!distributedSetup ? (
|
{!distributedSetup ? (
|
||||||
<DistributedOnly
|
<DistributedOnly
|
||||||
iconComponent={<InspectMenuIcon />}
|
iconComponent={<InspectMenuIcon />}
|
||||||
@@ -259,7 +254,7 @@ const Inspect = ({ classes }: { classes: any }) => {
|
|||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
|
onSubmit={(e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (plan !== "STANDARD" && plan !== "ENTERPRISE") {
|
if (!clusterRegistered) {
|
||||||
navigate("/support/register");
|
navigate("/support/register");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -349,7 +344,7 @@ const Inspect = ({ classes }: { classes: any }) => {
|
|||||||
<Button
|
<Button
|
||||||
id={"inspect-start"}
|
id={"inspect-start"}
|
||||||
type="submit"
|
type="submit"
|
||||||
variant={!registeredCluster ? "regular" : "callAction"}
|
variant={!clusterRegistered ? "regular" : "callAction"}
|
||||||
data-test-id="inspect-submit-button"
|
data-test-id="inspect-submit-button"
|
||||||
disabled={!isFormValid}
|
disabled={!isFormValid}
|
||||||
label={"Inspect"}
|
label={"Inspect"}
|
||||||
|
|||||||
Reference in New Issue
Block a user