Skip to content

Commit cdadb05

Browse files
authored
Move Tenant from Modal to Page (#596)
* Move Tenant from Modal to Page * Address comments * Small margin tweak
1 parent 1dcdc61 commit cdadb05

File tree

7 files changed

+103
-56
lines changed

7 files changed

+103
-56
lines changed

pkg/acl/endpoints.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var (
3232
bucketsDetail = "/buckets/:bucketName"
3333
serviceAccounts = "/account"
3434
tenants = "/tenants"
35+
addTenant = "/add-tenant"
3536
tenantsDetail = "/namespaces/:tenantNamespace/tenants/:tenantName"
3637
remoteBuckets = "/remote-buckets"
3738
replication = "/replication"
@@ -270,6 +271,7 @@ var endpointRules = map[string]ConfigurationActionSet{
270271
var operatorRules = map[string]ConfigurationActionSet{
271272
tenants: tenantsActionSet,
272273
tenantsDetail: tenantsActionSet,
274+
addTenant: tenantsActionSet,
273275
license: licenseActionSet,
274276
}
275277

pkg/acl/endpoints_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func TestOperatorOnlyEndpoints(t *testing.T) {
116116
"admin:*",
117117
},
118118
},
119-
want: 3,
119+
want: 4,
120120
},
121121
{
122122
name: "Operator Only - all s3 endpoints",
@@ -125,7 +125,7 @@ func TestOperatorOnlyEndpoints(t *testing.T) {
125125
"s3:*",
126126
},
127127
},
128-
want: 3,
128+
want: 4,
129129
},
130130
{
131131
name: "Operator Only - all admin and s3 endpoints",
@@ -135,14 +135,14 @@ func TestOperatorOnlyEndpoints(t *testing.T) {
135135
"s3:*",
136136
},
137137
},
138-
want: 3,
138+
want: 4,
139139
},
140140
{
141141
name: "Operator Only - default endpoints",
142142
args: args{
143143
[]string{},
144144
},
145-
want: 3,
145+
want: 4,
146146
},
147147
}
148148

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

Lines changed: 59 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import React, { useState } from "react";
1818
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
1919
import { IWizardMain } from "./types";
2020
import WizardPage from "./WizardPage";
21+
import { Grid, Paper } from "@material-ui/core";
2122

2223
const styles = (theme: Theme) =>
2324
createStyles({
@@ -26,11 +27,15 @@ const styles = (theme: Theme) =>
2627
width: "100%",
2728
flexGrow: 1,
2829
},
30+
wizFromContainer: {
31+
marginTop: "32px",
32+
},
2933
wizardSteps: {
3034
minWidth: 180,
3135
marginRight: 10,
3236
"& ul": {
33-
padding: "0 15px 0 0",
37+
padding: "0px 15px 0 30px",
38+
marginTop: "0px",
3439

3540
"& li": {
3641
listStyle: "lower-roman",
@@ -51,8 +56,15 @@ const styles = (theme: Theme) =>
5156
boxShadow: "none",
5257
},
5358
},
54-
wizardContainer: {
55-
flexGrow: 1,
59+
paddedGridItem: {
60+
padding: "0px 10px 0px 10px",
61+
},
62+
menuPaper: {
63+
padding: "20px",
64+
},
65+
paperContainer: {
66+
padding: "10px",
67+
maxWidth: "900px",
5668
},
5769
});
5870

@@ -101,28 +113,50 @@ const GenericWizard = ({ classes, wizardSteps }: IWizardMain) => {
101113
}
102114

103115
return (
104-
<div className={classes.wizardMain}>
105-
<div className={classes.wizardSteps}>
106-
<ul>
107-
{wizardSteps.map((step, index) => {
108-
return (
109-
<li key={`wizard-${index.toString()}`}>
110-
<button
111-
onClick={() => pageChange(index)}
112-
disabled={index > currentStep}
113-
className={classes.buttonList}
114-
>
115-
{step.label}
116-
</button>
117-
</li>
118-
);
119-
})}
120-
</ul>
121-
</div>
122-
<div className={classes.wizardContainer}>
123-
<WizardPage page={wizardSteps[currentStep]} pageChange={pageChange} />
124-
</div>
125-
</div>
116+
<Grid container className={classes.wizFromContainer}>
117+
<Grid
118+
item
119+
xs={12}
120+
sm={3}
121+
md={3}
122+
lg={3}
123+
xl={2}
124+
className={classes.paddedGridItem}
125+
>
126+
<Paper className={classes.menuPaper}>
127+
<div className={classes.wizardSteps}>
128+
<ul>
129+
{wizardSteps.map((step, index) => {
130+
return (
131+
<li key={`wizard-${index.toString()}`}>
132+
<button
133+
onClick={() => pageChange(index)}
134+
disabled={index > currentStep}
135+
className={classes.buttonList}
136+
>
137+
{step.label}
138+
</button>
139+
</li>
140+
);
141+
})}
142+
</ul>
143+
</div>
144+
</Paper>
145+
</Grid>
146+
<Grid
147+
item
148+
xs={12}
149+
sm={9}
150+
md={9}
151+
lg={9}
152+
xl={10}
153+
className={classes.paddedGridItem}
154+
>
155+
<Paper className={classes.paperContainer}>
156+
<WizardPage page={wizardSteps[currentStep]} pageChange={pageChange} />
157+
</Paper>
158+
</Grid>
159+
</Grid>
126160
);
127161
};
128162

portal-ui/src/screens/Console/Common/GenericWizard/WizardPage.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const styles = (theme: Theme) =>
2626
flexDirection: "column",
2727
},
2828
wizardComponent: {
29-
height: 375,
3029
overflowY: "auto",
3130
marginBottom: 10,
3231
},

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import LogsMain from "./Logs/LogsMain";
5555
import Heal from "./Heal/Heal";
5656
import Watch from "./Watch/Watch";
5757
import HealthInfo from "./HealthInfo/HealthInfo";
58+
import AddTenant from "./Tenants/ListTenants/AddTenant";
5859

5960
const drawerWidth = 245;
6061

@@ -289,6 +290,10 @@ const Console = ({
289290
component: WebhookPanel,
290291
path: "/webhook/audit",
291292
},
293+
{
294+
component: AddTenant,
295+
path: "/add-tenant",
296+
},
292297
{
293298
component: ListTenants,
294299
path: "/tenants",

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

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ import get from "lodash/get";
2020
import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper";
2121
import Grid from "@material-ui/core/Grid";
2222
import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper";
23-
import { Button, LinearProgress, Typography } from "@material-ui/core";
23+
import { Button, LinearProgress, Paper, Typography } from "@material-ui/core";
2424
import Table from "@material-ui/core/Table";
2525
import TableBody from "@material-ui/core/TableBody";
2626
import TableCell from "@material-ui/core/TableCell";
2727
import TableRow from "@material-ui/core/TableRow";
2828
import api from "../../../../common/api";
2929
import { createStyles, Theme, withStyles } from "@material-ui/core/styles";
30-
import { modalBasic } from "../../Common/FormComponents/common/styleLibrary";
30+
import {
31+
containerForHeader,
32+
modalBasic,
33+
} from "../../Common/FormComponents/common/styleLibrary";
3134
import FormSwitchWrapper from "../../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper";
3235
import SelectWrapper from "../../Common/FormComponents/SelectWrapper/SelectWrapper";
3336
import {
@@ -67,6 +70,8 @@ import Divider from "@material-ui/core/Divider";
6770
import { connect } from "react-redux";
6871
import { setModalErrorSnackMessage } from "../../../../actions";
6972
import { getHardcodedAffinity } from "../TenantDetails/utils";
73+
import history from "../../../../history";
74+
import PageHeader from "../../Common/PageHeader/PageHeader";
7075

7176
interface IAddTenantProps {
7277
open: boolean;
@@ -97,7 +102,6 @@ const styles = (theme: Theme) =>
97102
top: 0,
98103
paddingTop: 5,
99104
marginBottom: 10,
100-
backgroundColor: "#fff",
101105
zIndex: 500,
102106
},
103107
tableTitle: {
@@ -121,14 +125,21 @@ const styles = (theme: Theme) =>
121125
color: "#777777",
122126
},
123127
...modalBasic,
128+
container: {
129+
padding: "77px 0 0 0",
130+
"& h6": {
131+
color: "#777777",
132+
fontSize: 14,
133+
},
134+
"& p": {
135+
"& span:not(*[class*='smallUnit'])": {
136+
fontSize: 16,
137+
},
138+
},
139+
},
124140
});
125141

126-
const AddTenant = ({
127-
open,
128-
closeModalAndRefresh,
129-
setModalErrorSnackMessage,
130-
classes,
131-
}: IAddTenantProps) => {
142+
const AddTenant = ({ classes }: IAddTenantProps) => {
132143
// Fields
133144
const [addSending, setAddSending] = useState<boolean>(false);
134145
const [tenantName, setTenantName] = useState<string>("");
@@ -1179,7 +1190,7 @@ const AddTenant = ({
11791190
};
11801191

11811192
setAddSending(false);
1182-
closeModalAndRefresh(true, newSrvAcc);
1193+
history.push("/tenants");
11831194
})
11841195
.catch((err) => {
11851196
setAddSending(false);
@@ -1202,7 +1213,7 @@ const AddTenant = ({
12021213
type: "other",
12031214
enabled: true,
12041215
action: () => {
1205-
closeModalAndRefresh(false, null);
1216+
history.push("/tenants");
12061217
},
12071218
};
12081219

@@ -2711,23 +2722,19 @@ const AddTenant = ({
27112722
}
27122723

27132724
return (
2714-
<ModalWrapper
2715-
title="Create Tenant"
2716-
modalOpen={open}
2717-
onClose={() => {
2718-
closeModalAndRefresh(false, null);
2719-
}}
2720-
aria-labelledby="alert-dialog-title"
2721-
aria-describedby="alert-dialog-description"
2722-
wideLimit={false}
2723-
>
2725+
<React.Fragment>
27242726
{addSending && (
27252727
<Grid item xs={12}>
27262728
<LinearProgress />
27272729
</Grid>
27282730
)}
2729-
<GenericWizard wizardSteps={filteredWizardSteps} />
2730-
</ModalWrapper>
2731+
<PageHeader label={"Add Tenant"} />
2732+
<Grid container>
2733+
<Grid item xs={12} className={classes.container}>
2734+
<GenericWizard wizardSteps={filteredWizardSteps} />
2735+
</Grid>
2736+
</Grid>
2737+
</React.Fragment>
27312738
);
27322739
};
27332740

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt"
4040
import history from "../../../../history";
4141
import RefreshIcon from "@material-ui/icons/Refresh";
4242
import PageHeader from "../../Common/PageHeader/PageHeader";
43+
import { Link } from "react-router-dom";
4344

4445
interface ITenantsList {
4546
classes: any;
@@ -242,9 +243,8 @@ const ListTenants = ({ classes, setErrorSnackMessage }: ITenantsList) => {
242243
variant="contained"
243244
color="primary"
244245
startIcon={<CreateIcon />}
245-
onClick={() => {
246-
setCreateTenantOpen(true);
247-
}}
246+
component={Link}
247+
to="/add-tenant"
248248
>
249249
Create Tenant
250250
</Button>

0 commit comments

Comments
 (0)