Disabled input fields and changed Register label in Subscription features (#2994)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -313,7 +313,7 @@ const HealthInfo = () => {
|
||||
variant={
|
||||
!clusterRegistered ? "regular" : "callAction"
|
||||
}
|
||||
disabled={startDiagnostic}
|
||||
disabled={startDiagnostic || !clusterRegistered}
|
||||
onClick={startDiagnosticAction}
|
||||
label={buttonStartText}
|
||||
/>
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
PageLayout,
|
||||
SpeedtestIcon,
|
||||
WarnIcon,
|
||||
InputBox,
|
||||
} from "mds";
|
||||
import { DateTime } from "luxon";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
@@ -44,7 +45,6 @@ import {
|
||||
IAM_SCOPES,
|
||||
} from "../../../common/SecureComponent/permissions";
|
||||
import STResults from "./STResults";
|
||||
import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
|
||||
import ProgressBarWrapper from "../Common/ProgressBarWrapper/ProgressBarWrapper";
|
||||
import InputUnitMenu from "../Common/FormComponents/InputUnitMenu/InputUnitMenu";
|
||||
import { SecureComponent } from "../../../common/SecureComponent";
|
||||
@@ -258,7 +258,7 @@ const Speedtest = () => {
|
||||
</Grid>
|
||||
<Grid item md sm={12}>
|
||||
<div style={{ marginLeft: 10, width: 300 }}>
|
||||
<InputBoxWrapper
|
||||
<InputBox
|
||||
id={"size"}
|
||||
name={"size"}
|
||||
label={"Object Size"}
|
||||
@@ -267,7 +267,7 @@ const Speedtest = () => {
|
||||
}}
|
||||
noLabelMinWidth={true}
|
||||
value={size}
|
||||
disabled={start}
|
||||
disabled={start || !clusterRegistered}
|
||||
overlayObject={
|
||||
<InputUnitMenu
|
||||
id={"size-unit"}
|
||||
@@ -278,7 +278,7 @@ const Speedtest = () => {
|
||||
{ label: "MiB", value: "MiB" },
|
||||
{ label: "GiB", value: "GiB" },
|
||||
]}
|
||||
disabled={start}
|
||||
disabled={start || !clusterRegistered}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@@ -286,7 +286,7 @@ const Speedtest = () => {
|
||||
</Grid>
|
||||
<Grid item md sm={12}>
|
||||
<div style={{ marginLeft: 10, width: 300 }}>
|
||||
<InputBoxWrapper
|
||||
<InputBox
|
||||
id={"duration"}
|
||||
name={"duration"}
|
||||
label={"Duration"}
|
||||
@@ -297,14 +297,14 @@ const Speedtest = () => {
|
||||
}}
|
||||
noLabelMinWidth={true}
|
||||
value={duration}
|
||||
disabled={start}
|
||||
disabled={start || !clusterRegistered}
|
||||
overlayObject={
|
||||
<InputUnitMenu
|
||||
id={"size-unit"}
|
||||
onUnitChange={() => {}}
|
||||
unitSelected={"s"}
|
||||
unitsList={[{ label: "s", value: "s" }]}
|
||||
disabled={start}
|
||||
disabled={start || !clusterRegistered}
|
||||
/>
|
||||
}
|
||||
pattern={"[0-9]*"}
|
||||
@@ -324,7 +324,10 @@ const Speedtest = () => {
|
||||
}
|
||||
className={`${classes.buttonBackground} ${classes.speedStart}`}
|
||||
disabled={
|
||||
duration.trim() === "" || size.trim() === "" || start
|
||||
duration.trim() === "" ||
|
||||
size.trim() === "" ||
|
||||
start ||
|
||||
!clusterRegistered
|
||||
}
|
||||
label={buttonLabel}
|
||||
/>
|
||||
|
||||
@@ -207,7 +207,7 @@ const CallHome = () => {
|
||||
variant={"secondary"}
|
||||
data-test-id="call-home-toggle-button"
|
||||
onClick={disableCallHomeAction}
|
||||
disabled={loading}
|
||||
disabled={loading || !clusterRegistered}
|
||||
>
|
||||
Disable Call Home
|
||||
</Button>
|
||||
@@ -218,7 +218,7 @@ const CallHome = () => {
|
||||
variant={mainVariant}
|
||||
data-test-id="call-home-toggle-button"
|
||||
onClick={confirmCallHomeAction}
|
||||
disabled={loading}
|
||||
disabled={loading || !clusterRegistered}
|
||||
>
|
||||
Save Configuration
|
||||
</Button>
|
||||
|
||||
@@ -132,7 +132,7 @@ const Profile = () => {
|
||||
{typesList.map((t) => (
|
||||
<Checkbox
|
||||
checked={types.indexOf(t.value) > -1}
|
||||
disabled={profilingStarted}
|
||||
disabled={profilingStarted || !clusterRegistered}
|
||||
key={`checkbox-${t.label}`}
|
||||
id={`checkbox-${t.label}`}
|
||||
label={t.label}
|
||||
@@ -154,7 +154,9 @@ const Profile = () => {
|
||||
id={"start-profiling"}
|
||||
type="submit"
|
||||
variant={clusterRegistered ? "callAction" : "regular"}
|
||||
disabled={profilingStarted || types.length < 1}
|
||||
disabled={
|
||||
profilingStarted || types.length < 1 || !clusterRegistered
|
||||
}
|
||||
onClick={() => {
|
||||
if (!clusterRegistered) {
|
||||
navigate("/support/register");
|
||||
@@ -169,7 +171,7 @@ const Profile = () => {
|
||||
type="submit"
|
||||
variant="callAction"
|
||||
color="primary"
|
||||
disabled={!profilingStarted}
|
||||
disabled={!profilingStarted || !clusterRegistered}
|
||||
onClick={() => {
|
||||
stopProfiling();
|
||||
}}
|
||||
|
||||
@@ -39,7 +39,7 @@ const RegisterCluster = ({ compactMode = false }: IRegisterCluster) => {
|
||||
);
|
||||
|
||||
const registerMessage =
|
||||
"Use your MinIO Subscription Network login credentials to register this cluster.";
|
||||
"Please use your MinIO Subscription Network login credentials to register this cluster and enable this feature.";
|
||||
|
||||
if (compactMode) {
|
||||
return (
|
||||
|
||||
@@ -377,6 +377,7 @@ const Inspect = () => {
|
||||
error={volumeError}
|
||||
required
|
||||
placeholder={"test-bucket"}
|
||||
disabled={!clusterRegistered}
|
||||
/>
|
||||
<InputBox
|
||||
id="inspect_path"
|
||||
@@ -389,6 +390,7 @@ const Inspect = () => {
|
||||
value={inspectPath}
|
||||
required
|
||||
placeholder={"test*/xl.meta"}
|
||||
disabled={!clusterRegistered}
|
||||
/>
|
||||
<Switch
|
||||
label="Encrypt"
|
||||
@@ -400,6 +402,7 @@ const Inspect = () => {
|
||||
onChange={() => {
|
||||
setIsEncrypt(!isEncrypt);
|
||||
}}
|
||||
disabled={!clusterRegistered}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -419,13 +422,14 @@ const Inspect = () => {
|
||||
data-test-id="inspect-clear-button"
|
||||
onClick={resetForm}
|
||||
label={"Clear"}
|
||||
disabled={!clusterRegistered}
|
||||
/>
|
||||
<Button
|
||||
id={"inspect-start"}
|
||||
type="submit"
|
||||
variant={!clusterRegistered ? "regular" : "callAction"}
|
||||
data-test-id="inspect-submit-button"
|
||||
disabled={!isFormValid}
|
||||
disabled={!isFormValid || !clusterRegistered}
|
||||
label={"Inspect"}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -111,42 +111,6 @@ test("Form Input states verification", async (t) => {
|
||||
await t
|
||||
.expect(inspect_path_input_err.innerText)
|
||||
.eql("This field is required");
|
||||
|
||||
//Enter form values
|
||||
await t.typeText(inspect_volume_input, "/").typeText(inspect_path_input, "/");
|
||||
|
||||
//verify post state of Invalid values
|
||||
await t.expect(inspect_volume_input.value).eql("/");
|
||||
await t.expect(inspect_path_input.value).eql("/");
|
||||
await t
|
||||
.expect(inspect_volume_input_err.innerText)
|
||||
.eql("Volume/Bucket name cannot start with /");
|
||||
await t
|
||||
.expect(inspect_path_input_err.innerText)
|
||||
.eql("Path cannot start with /");
|
||||
await t.expect(inspect_form_submit_btn.hasAttribute("disabled")).eql(true);
|
||||
await t.expect(inspect_form_clear_btn.hasAttribute("disabled")).eql(false);
|
||||
|
||||
//Important. Testcafe's way to clear input values.
|
||||
await t.selectText(inspect_volume_input).pressKey("delete");
|
||||
await t.selectText(inspect_path_input).pressKey("delete");
|
||||
|
||||
//Enter Valid form values
|
||||
await t
|
||||
.typeText(inspect_volume_input, volumeValue)
|
||||
.typeText(inspect_path_input, pathValue);
|
||||
|
||||
//verify post state of valid values
|
||||
await t.expect(inspect_volume_input.value).eql(volumeValue);
|
||||
await t.expect(inspect_path_input.value).eql(pathValue);
|
||||
await t.expect(inspect_volume_input_err.exists).notOk();
|
||||
await t.expect(inspect_path_input_err.exists).notOk();
|
||||
|
||||
await t.click(inspect_form_clear_btn);
|
||||
//reset state verification
|
||||
await t.expect(inspect_volume_input.value).eql("");
|
||||
await t.expect(inspect_path_input.value).eql("");
|
||||
await t.expect(inspect_form_submit_btn.hasAttribute("disabled")).eql(true);
|
||||
});
|
||||
/** End Allowed Policy Test **/
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import * as roles from "../utils/roles";
|
||||
import * as elements from "../utils/elements";
|
||||
import { diagnosticsElement } from "../utils/elements-menu";
|
||||
import { ClientFunction } from "testcafe";
|
||||
|
||||
fixture("For user with Diagnostics permissions").page("http://localhost:9090");
|
||||
|
||||
@@ -39,113 +38,3 @@ test("Start Diagnostic button exists", async (t) => {
|
||||
.expect(startDiagnosticExists)
|
||||
.ok();
|
||||
});
|
||||
|
||||
test("Start Diagnostic button can be clicked", async (t) => {
|
||||
await t
|
||||
.useRole(roles.diagnostics)
|
||||
.navigateTo("http://localhost:9090/support/diagnostics")
|
||||
.click(elements.startDiagnosticButton);
|
||||
});
|
||||
|
||||
test("Download button exists after Diagnostic is completed", async (t) => {
|
||||
// MinIO can fail in the diagnostic and this is not UI problem
|
||||
// If there is an error with diagnostic, don't proceed with UI testing
|
||||
// Only proceed if there is no error
|
||||
const matchingElement = ClientFunction(() =>
|
||||
document.evaluate(
|
||||
"//div[text()='An error occurred while getting the Diagnostic file.']",
|
||||
document,
|
||||
null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await t
|
||||
.useRole(roles.diagnostics)
|
||||
.navigateTo("http://localhost:9090/support/diagnostics")
|
||||
.click(elements.startDiagnosticButton)
|
||||
.wait(3000);
|
||||
if ((await matchingElement()) == null) {
|
||||
// expect button only no error from minio diagnostic
|
||||
await t.expect(elements.downloadButton.exists).ok();
|
||||
}
|
||||
});
|
||||
|
||||
test("Download button is clickable after Diagnostic is completed", async (t) => {
|
||||
// MinIO can fail in the diagnostic and this is not UI problem
|
||||
// If there is an error with diagnostic, don't proceed with UI testing
|
||||
// Only proceed if there is no error
|
||||
const matchingElement = ClientFunction(() =>
|
||||
document.evaluate(
|
||||
"//div[text()='An error occurred while getting the Diagnostic file.']",
|
||||
document,
|
||||
null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await t
|
||||
.useRole(roles.diagnostics)
|
||||
.navigateTo("http://localhost:9090/support/diagnostics")
|
||||
.click(elements.startDiagnosticButton)
|
||||
.wait(2000);
|
||||
if ((await matchingElement()) == null) {
|
||||
// click only if no error
|
||||
await t.click(elements.downloadButton);
|
||||
}
|
||||
});
|
||||
|
||||
test("Start New Diagnostic button exists after Diagnostic is completed", async (t) => {
|
||||
// MinIO can fail in the diagnostic and this is not UI problem
|
||||
// If there is an error with diagnostic, don't proceed with UI testing
|
||||
// Only proceed if there is no error
|
||||
const matchingElement = ClientFunction(() =>
|
||||
document.evaluate(
|
||||
"//div[text()='An error occurred while getting the Diagnostic file.']",
|
||||
document,
|
||||
null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await t
|
||||
.useRole(roles.diagnostics)
|
||||
.navigateTo("http://localhost:9090/support/diagnostics")
|
||||
.click(elements.startDiagnosticButton)
|
||||
.wait(3000);
|
||||
if ((await matchingElement()) == null) {
|
||||
// expect button only if no error
|
||||
await t
|
||||
.expect(elements.downloadButton.exists)
|
||||
.ok()
|
||||
.expect(elements.startNewDiagnosticButton.exists)
|
||||
.ok();
|
||||
}
|
||||
});
|
||||
|
||||
test("Start New Diagnostic button is clickable after Diagnostic is completed", async (t) => {
|
||||
// MinIO can fail in the diagnostic and this is not UI problem
|
||||
// If there is an error with diagnostic, don't proceed with UI testing
|
||||
// Only proceed if there is no error
|
||||
const matchingElement = ClientFunction(() =>
|
||||
document.evaluate(
|
||||
"//div[text()='An error occurred while getting the Diagnostic file.']",
|
||||
document,
|
||||
null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||
null,
|
||||
),
|
||||
);
|
||||
await t
|
||||
.useRole(roles.diagnostics)
|
||||
.navigateTo("http://localhost:9090/support/diagnostics")
|
||||
.click(elements.startDiagnosticButton)
|
||||
.wait(3000);
|
||||
if ((await matchingElement()) == null) {
|
||||
// expect button only if no error
|
||||
await t
|
||||
.expect(elements.downloadButton.exists)
|
||||
.ok()
|
||||
.click(elements.startNewDiagnosticButton);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ export const createGroupButton =
|
||||
export const addAccessRuleButton =
|
||||
Selector("button:enabled").withText("Add Access Rule");
|
||||
export const startDiagnosticButton =
|
||||
Selector("button:enabled").withText("Start Diagnostic");
|
||||
Selector("button:disabled").withText("Start Diagnostic");
|
||||
export const startNewDiagnosticButton = Selector("#start-new-diagnostic");
|
||||
export const downloadButton = Selector("button:enabled").withText("Download");
|
||||
export const startButton = Selector("button:enabled").withText("Start");
|
||||
|
||||
Reference in New Issue
Block a user