Skip to content

Commit f958b73

Browse files
authored
Show Credentials after adding tenant (#599)
* Show Credentials after adding tenant * assets * Change order of routing
1 parent 940c7dc commit f958b73

File tree

3 files changed

+340
-319
lines changed

3 files changed

+340
-319
lines changed

portal-ui/bindata_assetfs.go

Lines changed: 307 additions & 314 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ const Console = ({
290290
component: WebhookPanel,
291291
path: "/webhook/audit",
292292
},
293-
{
294-
component: AddTenant,
295-
path: "/add-tenant",
296-
},
297293
{
298294
component: ListTenants,
299295
path: "/tenants",
300296
},
297+
{
298+
component: AddTenant,
299+
path: "/add-tenant",
300+
},
301301
{
302302
component: TenantDetails,
303303
path: "/namespaces/:tenantNamespace/tenants/:tenantName",

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

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ import { setModalErrorSnackMessage } from "../../../../actions";
7272
import { getHardcodedAffinity } from "../TenantDetails/utils";
7373
import history from "../../../../history";
7474
import PageHeader from "../../Common/PageHeader/PageHeader";
75+
import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt";
7576

7677
interface IAddTenantProps {
7778
open: boolean;
@@ -140,6 +141,13 @@ const styles = (theme: Theme) =>
140141
});
141142

142143
const AddTenant = ({ classes }: IAddTenantProps) => {
144+
// Modals
145+
const [showNewCredentials, setShowNewCredentials] = useState<boolean>(false);
146+
const [
147+
createdAccount,
148+
setCreatedAccount,
149+
] = useState<NewServiceAccount | null>(null);
150+
143151
// Fields
144152
const [addSending, setAddSending] = useState<boolean>(false);
145153
const [tenantName, setTenantName] = useState<string>("");
@@ -292,6 +300,10 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
292300
const [vaultCAVal, setVaultCAVal] = useState<string>("");
293301
const [gemaltoCAVal, setGemaltoCAVal] = useState<string>("");
294302

303+
// Flow
304+
305+
const showCredentialsAndRedirect = () => {};
306+
295307
// CA Certificates functions
296308
const addCaCertificate = () => {
297309
setCaCertificates((currentCertificates) => [
@@ -1225,7 +1237,9 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
12251237
};
12261238

12271239
setAddSending(false);
1228-
history.push("/tenants");
1240+
1241+
setShowNewCredentials(true);
1242+
setCreatedAccount(newSrvAcc);
12291243
})
12301244
.catch((err) => {
12311245
setAddSending(false);
@@ -2831,13 +2845,27 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
28312845
filteredWizardSteps = wizardSteps.filter((step) => !step.advancedOnly);
28322846
}
28332847

2848+
const closeCredentialsModal = () => {
2849+
history.push("/tenants");
2850+
};
2851+
28342852
return (
28352853
<React.Fragment>
28362854
{addSending && (
28372855
<Grid item xs={12}>
28382856
<LinearProgress />
28392857
</Grid>
28402858
)}
2859+
{showNewCredentials && (
2860+
<CredentialsPrompt
2861+
newServiceAccount={createdAccount}
2862+
open={showNewCredentials}
2863+
closeModal={() => {
2864+
closeCredentialsModal();
2865+
}}
2866+
entity="Tenant"
2867+
/>
2868+
)}
28412869
<PageHeader label={"Add Tenant"} />
28422870
<Grid container>
28432871
<Grid item xs={12} className={classes.container}>

0 commit comments

Comments
 (0)