- {Object.entries(workspacePermissions).map(([category, allPermissions]) => {
- const allPermissionNames = Object.values(allPermissions).map(
- ({ permission }) => permission,
- );
- const isAllSelected = allPermissionNames.every((permission) =>
- selectedPermissions.includes(permission),
- );
-
- return (
-
-
-
{category}}
- description={`Select all permissions for ${category} in this workspace`}
- checked={isAllSelected}
- setChecked={(isChecked) => {
- allPermissionNames.forEach((permission) => {
- handleSetChecked(permission, isChecked);
- });
- }}
- />
-
+ {Object.entries(workspacePermissions).map(
+ ([category, allPermissions]) => {
+ const allPermissionNames = Object.values(allPermissions).map(
+ ({ permission }) => permission
+ );
+ const isAllSelected = allPermissionNames.every((permission) =>
+ selectedPermissions.includes(permission)
+ );
-
- {Object.entries(allPermissions).map(([action, { description, permission }]) => (
+ return (
+
+
handleSetChecked(permission, isChecked)}
+ permissionName={`selectAll-${category}`}
+ label={
+
+ {category}
+
+ }
+ description={`Select all permissions for ${category} in this workspace`}
+ checked={isAllSelected}
+ setChecked={(isChecked) => {
+ allPermissionNames.forEach((permission) => {
+ handleSetChecked(permission, isChecked);
+ });
+ }}
/>
- ))}
+
+
+
+ {Object.entries(allPermissions).map(
+ ([action, { description, permission }]) => (
+
+ handleSetChecked(permission, isChecked)
+ }
+ />
+ )
+ )}
+
-
- );
- })}
+ );
+ }
+ )}
+
+
+
+ {
+ key.mutate({
+ name: name && name.length > 0 ? name : undefined,
+ permissions: selectedPermissions,
+ });
+ }}
+ >
+ {key.isLoading ? (
+
+ ) : (
+ "Create New Key"
+ )}
+
+
+
+
{apis.map((api) => (
= ({ apis }) => {
- Permissions scoped to this API. Enabling these roles only grants access to this
- specific API.
+ Permissions scoped to this API. Enabling these roles only
+ grants access to this specific API.
- {Object.entries(apiPermissions(api.id)).map(([category, roles]) => {
- const allPermissionNames = Object.values(roles).map(
- ({ permission }) => permission,
- );
- const isAllSelected = allPermissionNames.every((permission) =>
- selectedPermissions.includes(permission),
- );
-
- return (
-
-
-
{category}
- }
- description={`Select all ${category} permissions for this API`}
- checked={isAllSelected}
- setChecked={(isChecked) => {
- allPermissionNames.forEach((permission) => {
- handleSetChecked(permission, isChecked);
- });
- }}
- />
-
+ {Object.entries(apiPermissions(api.id)).map(
+ ([category, roles]) => {
+ const allPermissionNames = Object.values(roles).map(
+ ({ permission }) => permission
+ );
+ const isAllSelected = allPermissionNames.every(
+ (permission) => selectedPermissions.includes(permission)
+ );
-
- {Object.entries(roles).map(([action, { description, permission }]) => (
+ return (
+
+
handleSetChecked(permission, isChecked)}
+ permissionName={`selectAll-${category}`}
+ label={
+
+ {category}
+
+ }
+ description={`Select all ${category} permissions for this API`}
+ checked={isAllSelected}
+ setChecked={(isChecked) => {
+ allPermissionNames.forEach((permission) => {
+ handleSetChecked(permission, isChecked);
+ });
+ }}
/>
- ))}
+
+
+
+ {Object.entries(roles).map(
+ ([action, { description, permission }]) => (
+
+ handleSetChecked(permission, isChecked)
+ }
+ />
+ )
+ )}
+
-
- );
- })}
+ );
+ }
+ )}
))}
-
{
- key.mutate({
- name: name && name.length > 0 ? name : undefined,
- permissions: selectedPermissions,
- });
- }}
- >
- {key.isLoading ? : "Create New Key"}
-
= ({ apis }) => {
Your API Key
- This key is only shown once and can not be recovered. Please store it somewhere safe.
+ This key is only shown once and can not be recovered. Please store
+ it somewhere safe.
@@ -304,11 +365,16 @@ export const Client: React.FC = ({ apis }) => {
-
+
- {showKeyInSnippet ? snippet : snippet.replace(key.data?.key ?? "", maskedKey)}
+ {showKeyInSnippet
+ ? snippet
+ : snippet.replace(key.data?.key ?? "", maskedKey)}
@@ -354,13 +420,17 @@ const PermissionToggle: React.FC = ({
- {permissionName}
+
+ {permissionName}
+
-