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
13 changes: 12 additions & 1 deletion k8s/console/base/console-cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ rules:
- ""
resources:
- namespaces
- secrets
- pods
- services
- events
Expand All @@ -18,6 +17,18 @@ rules:
- create
- list
- patch
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
- watch
- create
- list
- patch
- deletecollection
- delete
- apiGroups:
- "storage.k8s.io"
resources:
Expand Down
2 changes: 1 addition & 1 deletion k8s/operator-console/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ resources:
- console-configmap.yaml
- console-service.yaml
- console-deployment.yaml
- https://github.com/minio/operator/?ref=v3.0.10
- https://github.com/minio/operator/?ref=v3.0.19
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const TableWrapper = ({
</Grid>
</Grid>
)}
{records && records.length > 0 ? (
{records && !isLoading && records.length > 0 ? (
<Table size="small" stickyHeader={stickyHeader}>
<TableHead className={classes.minTableHeader}>
<TableRow>
Expand Down
81 changes: 39 additions & 42 deletions portal-ui/src/screens/Console/Tenants/ListTenants/AddTenant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from "../../../../common/utils";
import {
commonFormValidation,
IValidation
IValidation,
} from "../../../../utils/validationFunctions";
import GenericWizard from "../../Common/GenericWizard/GenericWizard";
import { IWizardElement } from "../../Common/GenericWizard/types";
Expand All @@ -52,49 +52,50 @@ import {
ICapacity,
ITenantCreator,
} from "../../../../common/types";
import { NewTenantCredential } from "./TenantCredentialsPrompt/types";

interface IAddTenantProps {
open: boolean;
closeModalAndRefresh: (
reloadData: boolean,
res: NewServiceAccount | null
res: NewTenantCredential | null
) => any;
classes: any;
}

const styles = (theme: Theme) =>
createStyles({
errorBlock: {
color: "red"
color: "red",
},
buttonContainer: {
textAlign: "right"
textAlign: "right",
},
multiContainer: {
display: "flex",
alignItems: "center" as const,
justifyContent: "flex-start" as const
justifyContent: "flex-start" as const,
},
sizeFactorContainer: {
marginLeft: 8,
alignSelf: "flex-start" as const
alignSelf: "flex-start" as const,
},
headerElement: {
position: "sticky",
top: 0,
paddingTop: 5,
marginBottom: 10,
backgroundColor: "#fff",
zIndex: 500
zIndex: 500,
},
tableTitle: {
fontWeight: 700,
width: "30%"
width: "30%",
},
zoneError: {
color: "#dc1f2e",
fontSize: "0.75rem",
paddingLeft: 120
paddingLeft: 120,
},
error: {
color: "#dc1f2e",
Expand All @@ -111,7 +112,7 @@ interface Opts {
const AddTenant = ({
open,
closeModalAndRefresh,
classes
classes,
}: IAddTenantProps) => {
// Fields
const [addSending, setAddSending] = useState<boolean>(false);
Expand Down Expand Up @@ -212,7 +213,9 @@ const AddTenant = ({
const elements = get(res, "elements", []);

const newStorage = elements.map((storageClass: any) => {
const name = get(storageClass, "name", "").split(".")[0];
const name = get(storageClass, "name", "").split(
".storageclass.storage.k8s.io/requests.storage"
)[0];

return { label: name, value: name };
});
Expand Down Expand Up @@ -265,16 +268,6 @@ const AddTenant = ({
);

setDistribution(distrCalculate);

/*const errorDistribution = get(distrCalculate, "error", "");

if (errorDistribution === "") {
const disksPerServer = get(distrCalculate, "disks", 0);
const totalNodes = get(distrCalculate, "nodes", 0);
const sizePerVolume = get(distrCalculate, "pvSize", 0);

getParity(totalNodes, disksPerServer, sizePerVolume);
}*/
};

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

setNameTenantValid(
!("tenant-name" in commonValidation) &&
!("namespace" in commonValidation) &&
storageClasses.length > 0
!("namespace" in commonValidation) &&
storageClasses.length > 0
);

setValidationErrors(commonValidation);
Expand Down Expand Up @@ -337,9 +330,9 @@ const AddTenant = ({

setConfigValid(
!("nodes" in commonValidation) &&
!("volume_size" in commonValidation) &&
!("memory_per_node" in commonValidation) &&
distribution.error === ""
!("volume_size" in commonValidation) &&
!("memory_per_node" in commonValidation) &&
distribution.error === ""
);

setValidationErrors(commonValidation);
Expand All @@ -356,8 +349,8 @@ const AddTenant = ({
required: true,
value: imageName,
pattern: /^((.*?)\/(.*?):(.+))$/,
customPatternMessage: "Format must be of form: 'minio/minio:VERSION'"
}
customPatternMessage: "Format must be of form: 'minio/minio:VERSION'",
},
];
}

Expand Down Expand Up @@ -590,9 +583,13 @@ const AddTenant = ({
api
.invoke("POST", `/api/v1/tenants`, dataSend)
.then((res) => {
const newSrvAcc: NewServiceAccount = {
const newSrvAcc: NewTenantCredential = {
accessKey: res.access_key,
secretKey: res.secret_key,
console: {
accessKey: res.console.access_key,
secretKey: res.console.secret_key,
},
};

setAddSending(false);
Expand Down Expand Up @@ -620,7 +617,7 @@ const AddTenant = ({
enabled: true,
action: () => {
closeModalAndRefresh(false, null);
}
},
};

const wizardSteps: IWizardElement[] = [
Expand Down Expand Up @@ -690,7 +687,7 @@ const AddTenant = ({
id="adv_mode"
name="adv_mode"
checked={advancedMode}
onChange={e => {
onChange={(e) => {
const targetD = e.target;
const checked = targetD.checked;

Expand All @@ -703,8 +700,8 @@ const AddTenant = ({
),
buttons: [
cancelButton,
{ label: "Next", type: "next", enabled: nameTenantValid }
]
{ label: "Next", type: "next", enabled: nameTenantValid },
],
},
{
label: "Configure",
Expand Down Expand Up @@ -1080,8 +1077,8 @@ const AddTenant = ({
buttons: [
cancelButton,
{ label: "Back", type: "back", enabled: true },
{ label: "Next", type: "next", enabled: true }
]
{ label: "Next", type: "next", enabled: true },
],
},
{
label: "Encryption",
Expand Down Expand Up @@ -1504,8 +1501,8 @@ const AddTenant = ({
buttons: [
cancelButton,
{ label: "Back", type: "back", enabled: true },
{ label: "Next", type: "next", enabled: true }
]
{ label: "Next", type: "next", enabled: true },
],
},
{
label: "Tenant Size",
Expand Down Expand Up @@ -1720,16 +1717,16 @@ const AddTenant = ({
enabled: !addSending,
action: () => {
setAddSending(true);
}
}
]
}
},
},
],
},
];

let filteredWizardSteps = wizardSteps;

if (!advancedMode) {
filteredWizardSteps = wizardSteps.filter(step => !step.advancedOnly);
filteredWizardSteps = wizardSteps.filter((step) => !step.advancedOnly);
}

return (
Expand Down
22 changes: 18 additions & 4 deletions portal-ui/src/screens/Console/Tenants/ListTenants/ListTenants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Typography from "@material-ui/core/Typography";
import TextField from "@material-ui/core/TextField";
import InputAdornment from "@material-ui/core/InputAdornment";
import SearchIcon from "@material-ui/icons/Search";
import { Button } from "@material-ui/core";
import { Button, IconButton } from "@material-ui/core";
import { CreateIcon } from "../../../../icons";
import TableWrapper from "../../Common/TableWrapper/TableWrapper";
import { MinTablePaginationActions } from "../../../../common/MinTablePaginationActions";
Expand All @@ -33,6 +33,9 @@ import AddTenant from "./AddTenant";
import { NewServiceAccount } from "../../Common/CredentialsPrompt/types";
import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt";
import history from "../../../../history";
import RefreshIcon from "@material-ui/icons/Refresh";
import TenantCredentialsPrompt from "./TenantCredentialsPrompt/TenantCredentialsPrompt";
import { NewTenantCredential } from "./TenantCredentialsPrompt/types";

interface ITenantsList {
classes: any;
Expand Down Expand Up @@ -97,11 +100,11 @@ const ListTenants = ({ classes }: ITenantsList) => {
const [
createdAccount,
setCreatedAccount,
] = useState<NewServiceAccount | null>(null);
] = useState<NewTenantCredential | null>(null);

const closeAddModalAndRefresh = (
reloadData: boolean,
res: NewServiceAccount | null
res: NewTenantCredential | null
) => {
setCreateTenantOpen(false);

Expand Down Expand Up @@ -235,7 +238,7 @@ const ListTenants = ({ classes }: ITenantsList) => {
/>
)}
{showNewCredentials && (
<CredentialsPrompt
<TenantCredentialsPrompt
newServiceAccount={createdAccount}
open={showNewCredentials}
closeModal={() => {
Expand All @@ -252,6 +255,17 @@ const ListTenants = ({ classes }: ITenantsList) => {
<br />
</Grid>
<Grid item xs={12} className={classes.actionsTray}>
<IconButton
color="primary"
aria-label="Refresh Tenant List"
component="span"
onClick={() => {
setIsLoading(true);
}}
>
<RefreshIcon />
</IconButton>

<TextField
placeholder="Search Tenants"
className={classes.searchField}
Expand Down
Loading