Skip to content

Commit 854181f

Browse files
authored
Disabled input fields and changed Register label in Subscription features (#2994)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent df99679 commit 854181f

File tree

9 files changed

+26
-164
lines changed

9 files changed

+26
-164
lines changed

portal-ui/src/screens/Console/HealthInfo/HealthInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ const HealthInfo = () => {
313313
variant={
314314
!clusterRegistered ? "regular" : "callAction"
315315
}
316-
disabled={startDiagnostic}
316+
disabled={startDiagnostic || !clusterRegistered}
317317
onClick={startDiagnosticAction}
318318
label={buttonStartText}
319319
/>

portal-ui/src/screens/Console/Speedtest/Speedtest.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
PageLayout,
2828
SpeedtestIcon,
2929
WarnIcon,
30+
InputBox,
3031
} from "mds";
3132
import { DateTime } from "luxon";
3233
import createStyles from "@mui/styles/createStyles";
@@ -44,7 +45,6 @@ import {
4445
IAM_SCOPES,
4546
} from "../../../common/SecureComponent/permissions";
4647
import STResults from "./STResults";
47-
import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
4848
import ProgressBarWrapper from "../Common/ProgressBarWrapper/ProgressBarWrapper";
4949
import InputUnitMenu from "../Common/FormComponents/InputUnitMenu/InputUnitMenu";
5050
import { SecureComponent } from "../../../common/SecureComponent";
@@ -258,7 +258,7 @@ const Speedtest = () => {
258258
</Grid>
259259
<Grid item md sm={12}>
260260
<div style={{ marginLeft: 10, width: 300 }}>
261-
<InputBoxWrapper
261+
<InputBox
262262
id={"size"}
263263
name={"size"}
264264
label={"Object Size"}
@@ -267,7 +267,7 @@ const Speedtest = () => {
267267
}}
268268
noLabelMinWidth={true}
269269
value={size}
270-
disabled={start}
270+
disabled={start || !clusterRegistered}
271271
overlayObject={
272272
<InputUnitMenu
273273
id={"size-unit"}
@@ -278,15 +278,15 @@ const Speedtest = () => {
278278
{ label: "MiB", value: "MiB" },
279279
{ label: "GiB", value: "GiB" },
280280
]}
281-
disabled={start}
281+
disabled={start || !clusterRegistered}
282282
/>
283283
}
284284
/>
285285
</div>
286286
</Grid>
287287
<Grid item md sm={12}>
288288
<div style={{ marginLeft: 10, width: 300 }}>
289-
<InputBoxWrapper
289+
<InputBox
290290
id={"duration"}
291291
name={"duration"}
292292
label={"Duration"}
@@ -297,14 +297,14 @@ const Speedtest = () => {
297297
}}
298298
noLabelMinWidth={true}
299299
value={duration}
300-
disabled={start}
300+
disabled={start || !clusterRegistered}
301301
overlayObject={
302302
<InputUnitMenu
303303
id={"size-unit"}
304304
onUnitChange={() => {}}
305305
unitSelected={"s"}
306306
unitsList={[{ label: "s", value: "s" }]}
307-
disabled={start}
307+
disabled={start || !clusterRegistered}
308308
/>
309309
}
310310
pattern={"[0-9]*"}
@@ -324,7 +324,10 @@ const Speedtest = () => {
324324
}
325325
className={`${classes.buttonBackground} ${classes.speedStart}`}
326326
disabled={
327-
duration.trim() === "" || size.trim() === "" || start
327+
duration.trim() === "" ||
328+
size.trim() === "" ||
329+
start ||
330+
!clusterRegistered
328331
}
329332
label={buttonLabel}
330333
/>

portal-ui/src/screens/Console/Support/CallHome.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const CallHome = () => {
207207
variant={"secondary"}
208208
data-test-id="call-home-toggle-button"
209209
onClick={disableCallHomeAction}
210-
disabled={loading}
210+
disabled={loading || !clusterRegistered}
211211
>
212212
Disable Call Home
213213
</Button>
@@ -218,7 +218,7 @@ const CallHome = () => {
218218
variant={mainVariant}
219219
data-test-id="call-home-toggle-button"
220220
onClick={confirmCallHomeAction}
221-
disabled={loading}
221+
disabled={loading || !clusterRegistered}
222222
>
223223
Save Configuration
224224
</Button>

portal-ui/src/screens/Console/Support/Profile.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const Profile = () => {
132132
{typesList.map((t) => (
133133
<Checkbox
134134
checked={types.indexOf(t.value) > -1}
135-
disabled={profilingStarted}
135+
disabled={profilingStarted || !clusterRegistered}
136136
key={`checkbox-${t.label}`}
137137
id={`checkbox-${t.label}`}
138138
label={t.label}
@@ -154,7 +154,9 @@ const Profile = () => {
154154
id={"start-profiling"}
155155
type="submit"
156156
variant={clusterRegistered ? "callAction" : "regular"}
157-
disabled={profilingStarted || types.length < 1}
157+
disabled={
158+
profilingStarted || types.length < 1 || !clusterRegistered
159+
}
158160
onClick={() => {
159161
if (!clusterRegistered) {
160162
navigate("/support/register");
@@ -169,7 +171,7 @@ const Profile = () => {
169171
type="submit"
170172
variant="callAction"
171173
color="primary"
172-
disabled={!profilingStarted}
174+
disabled={!profilingStarted || !clusterRegistered}
173175
onClick={() => {
174176
stopProfiling();
175177
}}

portal-ui/src/screens/Console/Support/RegisterCluster.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const RegisterCluster = ({ compactMode = false }: IRegisterCluster) => {
3939
);
4040

4141
const registerMessage =
42-
"Use your MinIO Subscription Network login credentials to register this cluster.";
42+
"Please use your MinIO Subscription Network login credentials to register this cluster and enable this feature.";
4343

4444
if (compactMode) {
4545
return (

portal-ui/src/screens/Console/Tools/Inspect.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ const Inspect = () => {
377377
error={volumeError}
378378
required
379379
placeholder={"test-bucket"}
380+
disabled={!clusterRegistered}
380381
/>
381382
<InputBox
382383
id="inspect_path"
@@ -389,6 +390,7 @@ const Inspect = () => {
389390
value={inspectPath}
390391
required
391392
placeholder={"test*/xl.meta"}
393+
disabled={!clusterRegistered}
392394
/>
393395
<Switch
394396
label="Encrypt"
@@ -400,6 +402,7 @@ const Inspect = () => {
400402
onChange={() => {
401403
setIsEncrypt(!isEncrypt);
402404
}}
405+
disabled={!clusterRegistered}
403406
/>
404407
<Box
405408
sx={{
@@ -419,13 +422,14 @@ const Inspect = () => {
419422
data-test-id="inspect-clear-button"
420423
onClick={resetForm}
421424
label={"Clear"}
425+
disabled={!clusterRegistered}
422426
/>
423427
<Button
424428
id={"inspect-start"}
425429
type="submit"
426430
variant={!clusterRegistered ? "regular" : "callAction"}
427431
data-test-id="inspect-submit-button"
428-
disabled={!isFormValid}
432+
disabled={!isFormValid || !clusterRegistered}
429433
label={"Inspect"}
430434
/>
431435
</Box>

portal-ui/tests/permissions-2/inspect.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,42 +111,6 @@ test("Form Input states verification", async (t) => {
111111
await t
112112
.expect(inspect_path_input_err.innerText)
113113
.eql("This field is required");
114-
115-
//Enter form values
116-
await t.typeText(inspect_volume_input, "/").typeText(inspect_path_input, "/");
117-
118-
//verify post state of Invalid values
119-
await t.expect(inspect_volume_input.value).eql("/");
120-
await t.expect(inspect_path_input.value).eql("/");
121-
await t
122-
.expect(inspect_volume_input_err.innerText)
123-
.eql("Volume/Bucket name cannot start with /");
124-
await t
125-
.expect(inspect_path_input_err.innerText)
126-
.eql("Path cannot start with /");
127-
await t.expect(inspect_form_submit_btn.hasAttribute("disabled")).eql(true);
128-
await t.expect(inspect_form_clear_btn.hasAttribute("disabled")).eql(false);
129-
130-
//Important. Testcafe's way to clear input values.
131-
await t.selectText(inspect_volume_input).pressKey("delete");
132-
await t.selectText(inspect_path_input).pressKey("delete");
133-
134-
//Enter Valid form values
135-
await t
136-
.typeText(inspect_volume_input, volumeValue)
137-
.typeText(inspect_path_input, pathValue);
138-
139-
//verify post state of valid values
140-
await t.expect(inspect_volume_input.value).eql(volumeValue);
141-
await t.expect(inspect_path_input.value).eql(pathValue);
142-
await t.expect(inspect_volume_input_err.exists).notOk();
143-
await t.expect(inspect_path_input_err.exists).notOk();
144-
145-
await t.click(inspect_form_clear_btn);
146-
//reset state verification
147-
await t.expect(inspect_volume_input.value).eql("");
148-
await t.expect(inspect_path_input.value).eql("");
149-
await t.expect(inspect_form_submit_btn.hasAttribute("disabled")).eql(true);
150114
});
151115
/** End Allowed Policy Test **/
152116

portal-ui/tests/permissions-5/diagnostics.ts

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import * as roles from "../utils/roles";
1818
import * as elements from "../utils/elements";
1919
import { diagnosticsElement } from "../utils/elements-menu";
20-
import { ClientFunction } from "testcafe";
2120

2221
fixture("For user with Diagnostics permissions").page("http://localhost:9090");
2322

@@ -39,113 +38,3 @@ test("Start Diagnostic button exists", async (t) => {
3938
.expect(startDiagnosticExists)
4039
.ok();
4140
});
42-
43-
test("Start Diagnostic button can be clicked", async (t) => {
44-
await t
45-
.useRole(roles.diagnostics)
46-
.navigateTo("http://localhost:9090/support/diagnostics")
47-
.click(elements.startDiagnosticButton);
48-
});
49-
50-
test("Download button exists after Diagnostic is completed", async (t) => {
51-
// MinIO can fail in the diagnostic and this is not UI problem
52-
// If there is an error with diagnostic, don't proceed with UI testing
53-
// Only proceed if there is no error
54-
const matchingElement = ClientFunction(() =>
55-
document.evaluate(
56-
"//div[text()='An error occurred while getting the Diagnostic file.']",
57-
document,
58-
null,
59-
XPathResult.FIRST_ORDERED_NODE_TYPE,
60-
null,
61-
),
62-
);
63-
await t
64-
.useRole(roles.diagnostics)
65-
.navigateTo("http://localhost:9090/support/diagnostics")
66-
.click(elements.startDiagnosticButton)
67-
.wait(3000);
68-
if ((await matchingElement()) == null) {
69-
// expect button only no error from minio diagnostic
70-
await t.expect(elements.downloadButton.exists).ok();
71-
}
72-
});
73-
74-
test("Download button is clickable after Diagnostic is completed", async (t) => {
75-
// MinIO can fail in the diagnostic and this is not UI problem
76-
// If there is an error with diagnostic, don't proceed with UI testing
77-
// Only proceed if there is no error
78-
const matchingElement = ClientFunction(() =>
79-
document.evaluate(
80-
"//div[text()='An error occurred while getting the Diagnostic file.']",
81-
document,
82-
null,
83-
XPathResult.FIRST_ORDERED_NODE_TYPE,
84-
null,
85-
),
86-
);
87-
await t
88-
.useRole(roles.diagnostics)
89-
.navigateTo("http://localhost:9090/support/diagnostics")
90-
.click(elements.startDiagnosticButton)
91-
.wait(2000);
92-
if ((await matchingElement()) == null) {
93-
// click only if no error
94-
await t.click(elements.downloadButton);
95-
}
96-
});
97-
98-
test("Start New Diagnostic button exists after Diagnostic is completed", async (t) => {
99-
// MinIO can fail in the diagnostic and this is not UI problem
100-
// If there is an error with diagnostic, don't proceed with UI testing
101-
// Only proceed if there is no error
102-
const matchingElement = ClientFunction(() =>
103-
document.evaluate(
104-
"//div[text()='An error occurred while getting the Diagnostic file.']",
105-
document,
106-
null,
107-
XPathResult.FIRST_ORDERED_NODE_TYPE,
108-
null,
109-
),
110-
);
111-
await t
112-
.useRole(roles.diagnostics)
113-
.navigateTo("http://localhost:9090/support/diagnostics")
114-
.click(elements.startDiagnosticButton)
115-
.wait(3000);
116-
if ((await matchingElement()) == null) {
117-
// expect button only if no error
118-
await t
119-
.expect(elements.downloadButton.exists)
120-
.ok()
121-
.expect(elements.startNewDiagnosticButton.exists)
122-
.ok();
123-
}
124-
});
125-
126-
test("Start New Diagnostic button is clickable after Diagnostic is completed", async (t) => {
127-
// MinIO can fail in the diagnostic and this is not UI problem
128-
// If there is an error with diagnostic, don't proceed with UI testing
129-
// Only proceed if there is no error
130-
const matchingElement = ClientFunction(() =>
131-
document.evaluate(
132-
"//div[text()='An error occurred while getting the Diagnostic file.']",
133-
document,
134-
null,
135-
XPathResult.FIRST_ORDERED_NODE_TYPE,
136-
null,
137-
),
138-
);
139-
await t
140-
.useRole(roles.diagnostics)
141-
.navigateTo("http://localhost:9090/support/diagnostics")
142-
.click(elements.startDiagnosticButton)
143-
.wait(3000);
144-
if ((await matchingElement()) == null) {
145-
// expect button only if no error
146-
await t
147-
.expect(elements.downloadButton.exists)
148-
.ok()
149-
.click(elements.startNewDiagnosticButton);
150-
}
151-
});

portal-ui/tests/utils/elements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const createGroupButton =
4040
export const addAccessRuleButton =
4141
Selector("button:enabled").withText("Add Access Rule");
4242
export const startDiagnosticButton =
43-
Selector("button:enabled").withText("Start Diagnostic");
43+
Selector("button:disabled").withText("Start Diagnostic");
4444
export const startNewDiagnosticButton = Selector("#start-new-diagnostic");
4545
export const downloadButton = Selector("button:enabled").withText("Download");
4646
export const startButton = Selector("button:enabled").withText("Start");

0 commit comments

Comments
 (0)