Skip to content

Commit b72d424

Browse files
authored
UI: Tweaks to multiple elements (#284)
1 parent 86426e9 commit b72d424

File tree

7 files changed

+118
-100
lines changed

7 files changed

+118
-100
lines changed

k8s/console/base/console-cluster-role.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ rules:
77
- ""
88
resources:
99
- namespaces
10-
- secrets
1110
- pods
1211
- services
1312
- events
@@ -18,6 +17,18 @@ rules:
1817
- create
1918
- list
2019
- patch
20+
- apiGroups:
21+
- ""
22+
resources:
23+
- secrets
24+
verbs:
25+
- get
26+
- watch
27+
- create
28+
- list
29+
- patch
30+
- deletecollection
31+
- delete
2132
- apiGroups:
2233
- "storage.k8s.io"
2334
resources:

k8s/operator-console/base/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ resources:
88
- console-configmap.yaml
99
- console-service.yaml
1010
- console-deployment.yaml
11-
- https://github.com/minio/operator/?ref=v3.0.10
11+
- https://github.com/minio/operator/?ref=v3.0.19

portal-ui/src/screens/Console/Common/TableWrapper/TableWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ const TableWrapper = ({
265265
</Grid>
266266
</Grid>
267267
)}
268-
{records && records.length > 0 ? (
268+
{records && !isLoading && records.length > 0 ? (
269269
<Table size="small" stickyHeader={stickyHeader}>
270270
<TableHead className={classes.minTableHeader}>
271271
<TableRow>

portal-ui/src/screens/Console/Tenants/ListTenants/AddTenant.tsx

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import {
4040
} from "../../../../common/utils";
4141
import {
4242
commonFormValidation,
43-
IValidation
43+
IValidation,
4444
} from "../../../../utils/validationFunctions";
4545
import GenericWizard from "../../Common/GenericWizard/GenericWizard";
4646
import { IWizardElement } from "../../Common/GenericWizard/types";
@@ -52,49 +52,50 @@ import {
5252
ICapacity,
5353
ITenantCreator,
5454
} from "../../../../common/types";
55+
import { NewTenantCredential } from "./TenantCredentialsPrompt/types";
5556

5657
interface IAddTenantProps {
5758
open: boolean;
5859
closeModalAndRefresh: (
5960
reloadData: boolean,
60-
res: NewServiceAccount | null
61+
res: NewTenantCredential | null
6162
) => any;
6263
classes: any;
6364
}
6465

6566
const styles = (theme: Theme) =>
6667
createStyles({
6768
errorBlock: {
68-
color: "red"
69+
color: "red",
6970
},
7071
buttonContainer: {
71-
textAlign: "right"
72+
textAlign: "right",
7273
},
7374
multiContainer: {
7475
display: "flex",
7576
alignItems: "center" as const,
76-
justifyContent: "flex-start" as const
77+
justifyContent: "flex-start" as const,
7778
},
7879
sizeFactorContainer: {
7980
marginLeft: 8,
80-
alignSelf: "flex-start" as const
81+
alignSelf: "flex-start" as const,
8182
},
8283
headerElement: {
8384
position: "sticky",
8485
top: 0,
8586
paddingTop: 5,
8687
marginBottom: 10,
8788
backgroundColor: "#fff",
88-
zIndex: 500
89+
zIndex: 500,
8990
},
9091
tableTitle: {
9192
fontWeight: 700,
92-
width: "30%"
93+
width: "30%",
9394
},
9495
zoneError: {
9596
color: "#dc1f2e",
9697
fontSize: "0.75rem",
97-
paddingLeft: 120
98+
paddingLeft: 120,
9899
},
99100
error: {
100101
color: "#dc1f2e",
@@ -111,7 +112,7 @@ interface Opts {
111112
const AddTenant = ({
112113
open,
113114
closeModalAndRefresh,
114-
classes
115+
classes,
115116
}: IAddTenantProps) => {
116117
// Fields
117118
const [addSending, setAddSending] = useState<boolean>(false);
@@ -212,7 +213,9 @@ const AddTenant = ({
212213
const elements = get(res, "elements", []);
213214

214215
const newStorage = elements.map((storageClass: any) => {
215-
const name = get(storageClass, "name", "").split(".")[0];
216+
const name = get(storageClass, "name", "").split(
217+
".storageclass.storage.k8s.io/requests.storage"
218+
)[0];
216219

217220
return { label: name, value: name };
218221
});
@@ -265,16 +268,6 @@ const AddTenant = ({
265268
);
266269

267270
setDistribution(distrCalculate);
268-
269-
/*const errorDistribution = get(distrCalculate, "error", "");
270-
271-
if (errorDistribution === "") {
272-
const disksPerServer = get(distrCalculate, "disks", 0);
273-
const totalNodes = get(distrCalculate, "nodes", 0);
274-
const sizePerVolume = get(distrCalculate, "pvSize", 0);
275-
276-
getParity(totalNodes, disksPerServer, sizePerVolume);
277-
}*/
278271
};
279272

280273
/*Calculate Allocation End*/
@@ -301,8 +294,8 @@ const AddTenant = ({
301294

302295
setNameTenantValid(
303296
!("tenant-name" in commonValidation) &&
304-
!("namespace" in commonValidation) &&
305-
storageClasses.length > 0
297+
!("namespace" in commonValidation) &&
298+
storageClasses.length > 0
306299
);
307300

308301
setValidationErrors(commonValidation);
@@ -337,9 +330,9 @@ const AddTenant = ({
337330

338331
setConfigValid(
339332
!("nodes" in commonValidation) &&
340-
!("volume_size" in commonValidation) &&
341-
!("memory_per_node" in commonValidation) &&
342-
distribution.error === ""
333+
!("volume_size" in commonValidation) &&
334+
!("memory_per_node" in commonValidation) &&
335+
distribution.error === ""
343336
);
344337

345338
setValidationErrors(commonValidation);
@@ -356,8 +349,8 @@ const AddTenant = ({
356349
required: true,
357350
value: imageName,
358351
pattern: /^((.*?)\/(.*?):(.+))$/,
359-
customPatternMessage: "Format must be of form: 'minio/minio:VERSION'"
360-
}
352+
customPatternMessage: "Format must be of form: 'minio/minio:VERSION'",
353+
},
361354
];
362355
}
363356

@@ -590,9 +583,13 @@ const AddTenant = ({
590583
api
591584
.invoke("POST", `/api/v1/tenants`, dataSend)
592585
.then((res) => {
593-
const newSrvAcc: NewServiceAccount = {
586+
const newSrvAcc: NewTenantCredential = {
594587
accessKey: res.access_key,
595588
secretKey: res.secret_key,
589+
console: {
590+
accessKey: res.console.access_key,
591+
secretKey: res.console.secret_key,
592+
},
596593
};
597594

598595
setAddSending(false);
@@ -620,7 +617,7 @@ const AddTenant = ({
620617
enabled: true,
621618
action: () => {
622619
closeModalAndRefresh(false, null);
623-
}
620+
},
624621
};
625622

626623
const wizardSteps: IWizardElement[] = [
@@ -690,7 +687,7 @@ const AddTenant = ({
690687
id="adv_mode"
691688
name="adv_mode"
692689
checked={advancedMode}
693-
onChange={e => {
690+
onChange={(e) => {
694691
const targetD = e.target;
695692
const checked = targetD.checked;
696693

@@ -703,8 +700,8 @@ const AddTenant = ({
703700
),
704701
buttons: [
705702
cancelButton,
706-
{ label: "Next", type: "next", enabled: nameTenantValid }
707-
]
703+
{ label: "Next", type: "next", enabled: nameTenantValid },
704+
],
708705
},
709706
{
710707
label: "Configure",
@@ -1080,8 +1077,8 @@ const AddTenant = ({
10801077
buttons: [
10811078
cancelButton,
10821079
{ label: "Back", type: "back", enabled: true },
1083-
{ label: "Next", type: "next", enabled: true }
1084-
]
1080+
{ label: "Next", type: "next", enabled: true },
1081+
],
10851082
},
10861083
{
10871084
label: "Encryption",
@@ -1504,8 +1501,8 @@ const AddTenant = ({
15041501
buttons: [
15051502
cancelButton,
15061503
{ label: "Back", type: "back", enabled: true },
1507-
{ label: "Next", type: "next", enabled: true }
1508-
]
1504+
{ label: "Next", type: "next", enabled: true },
1505+
],
15091506
},
15101507
{
15111508
label: "Tenant Size",
@@ -1720,16 +1717,16 @@ const AddTenant = ({
17201717
enabled: !addSending,
17211718
action: () => {
17221719
setAddSending(true);
1723-
}
1724-
}
1725-
]
1726-
}
1720+
},
1721+
},
1722+
],
1723+
},
17271724
];
17281725

17291726
let filteredWizardSteps = wizardSteps;
17301727

17311728
if (!advancedMode) {
1732-
filteredWizardSteps = wizardSteps.filter(step => !step.advancedOnly);
1729+
filteredWizardSteps = wizardSteps.filter((step) => !step.advancedOnly);
17331730
}
17341731

17351732
return (

portal-ui/src/screens/Console/Tenants/ListTenants/ListTenants.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Typography from "@material-ui/core/Typography";
2020
import TextField from "@material-ui/core/TextField";
2121
import InputAdornment from "@material-ui/core/InputAdornment";
2222
import SearchIcon from "@material-ui/icons/Search";
23-
import { Button } from "@material-ui/core";
23+
import { Button, IconButton } from "@material-ui/core";
2424
import { CreateIcon } from "../../../../icons";
2525
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
2626
import { MinTablePaginationActions } from "../../../../common/MinTablePaginationActions";
@@ -33,6 +33,9 @@ import AddTenant from "./AddTenant";
3333
import { NewServiceAccount } from "../../Common/CredentialsPrompt/types";
3434
import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt";
3535
import history from "../../../../history";
36+
import RefreshIcon from "@material-ui/icons/Refresh";
37+
import TenantCredentialsPrompt from "./TenantCredentialsPrompt/TenantCredentialsPrompt";
38+
import { NewTenantCredential } from "./TenantCredentialsPrompt/types";
3639

3740
interface ITenantsList {
3841
classes: any;
@@ -97,11 +100,11 @@ const ListTenants = ({ classes }: ITenantsList) => {
97100
const [
98101
createdAccount,
99102
setCreatedAccount,
100-
] = useState<NewServiceAccount | null>(null);
103+
] = useState<NewTenantCredential | null>(null);
101104

102105
const closeAddModalAndRefresh = (
103106
reloadData: boolean,
104-
res: NewServiceAccount | null
107+
res: NewTenantCredential | null
105108
) => {
106109
setCreateTenantOpen(false);
107110

@@ -235,7 +238,7 @@ const ListTenants = ({ classes }: ITenantsList) => {
235238
/>
236239
)}
237240
{showNewCredentials && (
238-
<CredentialsPrompt
241+
<TenantCredentialsPrompt
239242
newServiceAccount={createdAccount}
240243
open={showNewCredentials}
241244
closeModal={() => {
@@ -252,6 +255,17 @@ const ListTenants = ({ classes }: ITenantsList) => {
252255
<br />
253256
</Grid>
254257
<Grid item xs={12} className={classes.actionsTray}>
258+
<IconButton
259+
color="primary"
260+
aria-label="Refresh Tenant List"
261+
component="span"
262+
onClick={() => {
263+
setIsLoading(true);
264+
}}
265+
>
266+
<RefreshIcon />
267+
</IconButton>
268+
255269
<TextField
256270
placeholder="Search Tenants"
257271
className={classes.searchField}

0 commit comments

Comments
 (0)