Update MI docs for client id/secret

This commit is contained in:
Tuan Dang
2023-12-04 23:04:04 +07:00
parent 8b1eaad7b5
commit 28b617fd89
18 changed files with 52 additions and 71 deletions
@@ -27,7 +27,7 @@ export const MembersPage = withPermission(
<Tab value={TabSections.Member}>People</Tab>
<Tab value={TabSections.MachineIdentities}>
<div className="flex items-center">
<p>App Clients</p>
<p>Machine Identities</p>
<div className="ml-2 rounded-md text-yellow text-sm inline-block bg-yellow/20 px-1.5 pb-[0.03rem] pt-[0.04rem] opacity-80 hover:opacity-100 cursor-default">
New
</div>
@@ -263,7 +263,7 @@ export const AddMachineIdentityModal = ({
reset();
}}
>
<ModalContent title={`${popUp?.machineIdentity?.data ? "Update" : "Create"} App Client`}>
<ModalContent title={`${popUp?.machineIdentity?.data ? "Update" : "Create"} Machine Identity`}>
<form onSubmit={handleSubmit(onFormSubmit)}>
<Tabs defaultValue={TabSections.General}>
<TabList>
@@ -270,7 +270,7 @@ export const CreateClientSecretModal = ({
{!isLoading && data && data?.length === 0 && (
<Tr>
<Td colSpan={4}>
<EmptyState title="No client secrets have been created for this app client yet" icon={faKey} />
<EmptyState title="No client secrets have been created for this machine identity yet" icon={faKey} />
</Td>
</Tr>
)}
@@ -51,7 +51,7 @@ export const MachineIdentitySection = withPermission(
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="flex justify-between mb-8">
<p className="text-xl font-semibold text-mineshaft-100">
App Clients
Machine Identities
</p>
<OrgPermissionCan
I={OrgPermissionActions.Create}
@@ -65,7 +65,7 @@ export const MachineIdentitySection = withPermission(
onClick={() => handlePopUpOpen("machineIdentity")}
isDisabled={!isAllowed}
>
Create client
Create identity
</Button>
)}
</OrgPermissionCan>
@@ -151,29 +151,9 @@ export const MachineIdentityTable = ({
customRole
}) => {
return (
<Tr className="h-10" key={`st-v3-${_id}`}>
<Tr className="h-10" key={`machine-identity-${_id}`}>
<Td>{name}</Td>
<Td>{clientId}</Td>
{/* <Td>
<OrgPermissionCan
I={OrgPermissionActions.Edit}
a={OrgPermissionSubjects.MachineIdentity}
>
{(isAllowed) => (
<Switch
id={`enable-service-token-${_id}`}
onCheckedChange={(value) => handleToggleStatus({
serviceTokenDataId: _id,
isActive: value
})}
isChecked={isActive}
isDisabled={!isAllowed}
>
<p className="w-12 mr-4">{isActive ? "Active" : "Inactive"}</p>
</Switch>
)}
</OrgPermissionCan>
</Td> */}
<Td>
<OrgPermissionCan
I={OrgPermissionActions.Edit}
@@ -206,24 +186,8 @@ export const MachineIdentityTable = ({
}}
</OrgPermissionCan>
</Td>
{/* <Td>
{trustedIps.map(({
_id: trustedIpId,
ipAddress,
prefix
}) => {
return (
<p key={`service-token-${_id}-}-trusted-ip-${trustedIpId}`}>
{`${ipAddress}${prefix !== undefined ? `/${prefix}` : ""}`}
</p>
);
})}
</Td> */}
{/* <Td>{accessTokenTTL}</Td> */}
{/* <Td>{format(new Date(createdAt), "yyyy-MM-dd")}</Td> */}
{/* <Td>{expiresAt ? format(new Date(expiresAt), "yyyy-MM-dd") : "-"}</Td> */}
<Td className="flex justify-end">
<Td>
<div className="flex justify-end items-center">
<Tooltip content="Manage client secrets">
<IconButton
onClick={async () => {
@@ -292,6 +256,7 @@ export const MachineIdentityTable = ({
</IconButton>
)}
</OrgPermissionCan>
</div>
</Td>
</Tr>
);
@@ -299,7 +264,7 @@ export const MachineIdentityTable = ({
{!isLoading && data && data?.length === 0 && (
<Tr>
<Td colSpan={7}>
<EmptyState title="No app clients have been created in this organization" icon={faServer} />
<EmptyState title="No machine identities have been created in this organization" icon={faServer} />
</Td>
</Tr>
)}
@@ -32,7 +32,7 @@ export const MembersPage = withProjectPermission(
<Tab value={TabSections.Member}>People</Tab>
<Tab value={TabSections.MachineIdentities}>
<div className="flex items-center">
<p>App Clients</p>
<p>Machine Identities</p>
<div className="ml-2 rounded-md text-yellow text-sm inline-block bg-yellow/20 px-1.5 pb-[0.03rem] pt-[0.04rem] opacity-80 hover:opacity-100 cursor-default">
New
</div>
@@ -120,7 +120,7 @@ export const AddMachineIdentityModal = ({
reset();
}}
>
<ModalContent title="Add App Client to Project">
<ModalContent title="Add Machine Identity to Project">
{filteredMachineMembershipOrgs.length ? (
<form onSubmit={handleSubmit(onFormSubmit)}>
<Controller
@@ -129,7 +129,7 @@ export const AddMachineIdentityModal = ({
defaultValue={filteredMachineMembershipOrgs?.[0]?._id}
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
label="App Client"
label="Machine Identity"
errorText={error?.message}
isError={Boolean(error)}
>
@@ -62,7 +62,7 @@ export const MachineIdentitySection = withProjectPermission(
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="flex justify-between mb-8">
<p className="text-xl font-semibold text-mineshaft-100">
App Clients
Machine Identities
</p>
<ProjectPermissionCan
I={ProjectPermissionActions.Create}
@@ -76,7 +76,7 @@ export const MachineIdentitySection = withProjectPermission(
onClick={() => handlePopUpOpen("machineIdentity")}
isDisabled={!isAllowed}
>
Add client
Add identity
</Button>
)}
</ProjectPermissionCan>
@@ -188,7 +188,7 @@ export const MachineIdentityTable = ({
{!isLoading && data && data?.length === 0 && (
<Tr>
<Td colSpan={7}>
<EmptyState title="No app clients have been added to this project" icon={faServer} />
<EmptyState title="No machine identities have been added to this project" icon={faServer} />
</Td>
</Tr>
)}