@contember/create 2.1.0-rc.3 → 2.2.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +22 -0
- package/dist/development/run.cjs +7 -7
- package/dist/development/run.cjs.map +1 -1
- package/dist/development/run.js +8 -8
- package/dist/development/run.js.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs +28 -14
- package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/development/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/development/src/lib/FileSystem.cjs +1 -2
- package/dist/development/src/lib/FileSystem.cjs.map +1 -1
- package/dist/development/src/lib/FileSystem.js +1 -2
- package/dist/development/src/lib/FileSystem.js.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.cjs +79 -67
- package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/development/src/lib/TemplateInstaller.js +72 -60
- package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/development/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/development/src/lib/version.cjs +2 -2
- package/dist/development/src/lib/version.cjs.map +1 -1
- package/dist/development/src/lib/version.js.map +1 -1
- package/dist/development/src/paths.cjs +3 -3
- package/dist/development/src/paths.cjs.map +1 -1
- package/dist/production/run.cjs +7 -7
- package/dist/production/run.cjs.map +1 -1
- package/dist/production/run.js +8 -8
- package/dist/production/run.js.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs +28 -14
- package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
- package/dist/production/src/commands/WorkspaceCreateCommand.js +28 -14
- package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
- package/dist/production/src/lib/FileSystem.cjs +1 -2
- package/dist/production/src/lib/FileSystem.cjs.map +1 -1
- package/dist/production/src/lib/FileSystem.js +1 -2
- package/dist/production/src/lib/FileSystem.js.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.cjs +79 -67
- package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
- package/dist/production/src/lib/TemplateInstaller.js +72 -60
- package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
- package/dist/production/src/lib/packageManagerDetector.cjs +6 -6
- package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -1
- package/dist/production/src/lib/version.cjs +2 -2
- package/dist/production/src/lib/version.cjs.map +1 -1
- package/dist/production/src/lib/version.js.map +1 -1
- package/dist/production/src/paths.cjs +3 -3
- package/dist/production/src/paths.cjs.map +1 -1
- package/dist/types/commands/WorkspaceCreateCommand.d.ts +16 -4
- package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/index.d.ts.map +1 -1
- package/dist/types/lib/FileSystem.d.ts +3 -2
- package/dist/types/lib/FileSystem.d.ts.map +1 -1
- package/dist/types/lib/TemplateInstaller.d.ts +10 -2
- package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/resources/templates/default/README.md +3 -1
- package/resources/templates/default/admin/app/components/navigation.tsx +95 -8
- package/resources/templates/default/admin/app/pages/tenant.tsx +328 -77
- package/resources/templates/default/admin/entrypoint/components/login.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +1 -1
- package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +1 -1
- package/resources/templates/default/admin/lib/binding/binding.tsx +19 -4
- package/resources/templates/default/admin/lib/binding/delete.tsx +37 -3
- package/resources/templates/default/admin/lib/binding/hooks.tsx +65 -3
- package/resources/templates/default/admin/lib/binding/identity.tsx +17 -4
- package/resources/templates/default/admin/lib/binding/index.ts +5 -5
- package/resources/templates/default/admin/lib/binding/navigation-guard-dialog.tsx +15 -3
- package/resources/templates/default/admin/lib/binding/persist.tsx +27 -5
- package/resources/templates/default/admin/lib/block-repeater/block-repeater.tsx +15 -11
- package/resources/templates/default/admin/lib/block-repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/board/board.tsx +2 -2
- package/resources/templates/default/admin/lib/board/index.ts +1 -1
- package/resources/templates/default/admin/lib/buttons/back-button.tsx +22 -2
- package/resources/templates/default/admin/lib/buttons/index.ts +2 -2
- package/resources/templates/default/admin/lib/buttons/link-back-button.tsx +11 -2
- package/resources/templates/default/admin/lib/datagrid/cells.tsx +3 -3
- package/resources/templates/default/admin/lib/datagrid/column-header.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/columns.tsx +28 -14
- package/resources/templates/default/admin/lib/datagrid/elements.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/empty.tsx +1 -1
- package/resources/templates/default/admin/lib/datagrid/export.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/boolean.tsx +13 -13
- package/resources/templates/default/admin/lib/datagrid/filters/common.tsx +2 -2
- package/resources/templates/default/admin/lib/datagrid/filters/date.tsx +37 -16
- package/resources/templates/default/admin/lib/datagrid/filters/defined.tsx +13 -12
- package/resources/templates/default/admin/lib/datagrid/filters/enum.tsx +56 -22
- package/resources/templates/default/admin/lib/datagrid/filters/index.ts +7 -7
- package/resources/templates/default/admin/lib/datagrid/filters/mobile.tsx +18 -0
- package/resources/templates/default/admin/lib/datagrid/filters/number.tsx +10 -13
- package/resources/templates/default/admin/lib/datagrid/filters/relation.tsx +8 -8
- package/resources/templates/default/admin/lib/datagrid/filters/text.tsx +9 -9
- package/resources/templates/default/admin/lib/datagrid/grid.tsx +31 -23
- package/resources/templates/default/admin/lib/datagrid/index.ts +12 -12
- package/resources/templates/default/admin/lib/datagrid/labels.tsx +22 -4
- package/resources/templates/default/admin/lib/datagrid/layout-switcher.tsx +10 -4
- package/resources/templates/default/admin/lib/datagrid/loader.tsx +4 -4
- package/resources/templates/default/admin/lib/datagrid/pagination.tsx +16 -6
- package/resources/templates/default/admin/lib/datagrid/table.tsx +8 -6
- package/resources/templates/default/admin/lib/datagrid/tiles.tsx +6 -5
- package/resources/templates/default/admin/lib/datagrid/toolbar.tsx +15 -19
- package/resources/templates/default/admin/lib/datagrid/ui.tsx +3 -3
- package/resources/templates/default/admin/lib/dev/index.ts +2 -2
- package/resources/templates/default/admin/lib/dev/login-panel.tsx +12 -3
- package/resources/templates/default/admin/lib/dev/todo.tsx +12 -0
- package/resources/templates/default/admin/lib/dict.ts +0 -261
- package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +85 -4
- package/resources/templates/default/admin/lib/dimensions/index.ts +1 -1
- package/resources/templates/default/admin/lib/editor/block-editor.tsx +72 -3
- package/resources/templates/default/admin/lib/editor/common/baseEditorPlugins.tsx +54 -11
- package/resources/templates/default/admin/lib/editor/common/buttons.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/editor-block-toolbar.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/ListItemRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/OrderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/TableElementRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +1 -1
- package/resources/templates/default/admin/lib/editor/common/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/editor-block.tsx +54 -3
- package/resources/templates/default/admin/lib/editor/index.ts +6 -6
- package/resources/templates/default/admin/lib/editor/plugins.tsx +46 -2
- package/resources/templates/default/admin/lib/editor/rich-text-view.tsx +44 -0
- package/resources/templates/default/admin/lib/editor/rich-text.tsx +31 -3
- package/resources/templates/default/admin/lib/editor/sortable-block.tsx +34 -2
- package/resources/templates/default/admin/lib/errors/index.ts +1 -1
- package/resources/templates/default/admin/lib/errors/use-error-formatter.ts +22 -1
- package/resources/templates/default/admin/lib/field/formatted-field.tsx +16 -1
- package/resources/templates/default/admin/lib/field/index.ts +2 -1
- package/resources/templates/default/admin/lib/field/list-field.tsx +56 -0
- package/resources/templates/default/admin/lib/form/container.tsx +33 -3
- package/resources/templates/default/admin/lib/form/index.ts +6 -5
- package/resources/templates/default/admin/lib/form/inputs.tsx +105 -6
- package/resources/templates/default/admin/lib/form/labels.tsx +1 -1
- package/resources/templates/default/admin/lib/form/select.tsx +162 -5
- package/resources/templates/default/admin/lib/form/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +159 -5
- package/resources/templates/default/admin/lib/form/upload.tsx +116 -3
- package/resources/templates/default/admin/lib/formatting/formatting.ts +106 -1
- package/resources/templates/default/admin/lib/formatting/index.ts +1 -1
- package/resources/templates/default/admin/lib/images/formatImageResizeUrl.ts +19 -0
- package/resources/templates/default/admin/lib/images/index.ts +1 -1
- package/resources/templates/default/admin/lib/index.ts +54 -0
- package/resources/templates/default/admin/lib/labels/index.ts +2 -2
- package/resources/templates/default/admin/lib/layout/index.ts +3 -3
- package/resources/templates/default/admin/lib/layout/layout-boxed.tsx +5 -5
- package/resources/templates/default/admin/lib/layout/layout.tsx +3 -3
- package/resources/templates/default/admin/lib/outdated-application-dialog/index.ts +1 -1
- package/resources/templates/default/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/repeater/index.ts +1 -1
- package/resources/templates/default/admin/lib/repeater/repeater.tsx +26 -9
- package/resources/templates/default/admin/lib/select/create-new.tsx +19 -3
- package/resources/templates/default/admin/lib/select/filter.tsx +8 -2
- package/resources/templates/default/admin/lib/select/highlight.tsx +16 -0
- package/resources/templates/default/admin/lib/select/index.ts +6 -6
- package/resources/templates/default/admin/lib/select/list.tsx +30 -6
- package/resources/templates/default/admin/lib/select/multi-select.tsx +41 -4
- package/resources/templates/default/admin/lib/select/select.tsx +44 -6
- package/resources/templates/default/admin/lib/select/sortable-select.tsx +15 -6
- package/resources/templates/default/admin/lib/select/ui.tsx +100 -4
- package/resources/templates/default/admin/lib/tenant/config/auth-policy-list.tsx +86 -0
- package/resources/templates/default/admin/lib/tenant/config/common.tsx +71 -0
- package/resources/templates/default/admin/lib/tenant/config/identity-provider-list.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/config/index.ts +5 -0
- package/resources/templates/default/admin/lib/tenant/config/mail-template-list.tsx +108 -0
- package/resources/templates/default/admin/lib/tenant/config/tenant-config-view.tsx +182 -0
- package/resources/templates/default/admin/lib/tenant/dict.ts +770 -0
- package/resources/templates/default/admin/lib/tenant/errors.ts +10 -0
- package/resources/templates/default/admin/lib/tenant/forms/add-project-member.tsx +57 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-my-password.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/change-my-profile.tsx +40 -0
- package/resources/templates/default/admin/lib/tenant/forms/change-profile.tsx +55 -0
- package/resources/templates/default/admin/lib/tenant/forms/common.tsx +12 -5
- package/resources/templates/default/admin/lib/tenant/forms/confirm-email-change.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/forms/create-api-key.tsx +5 -5
- package/resources/templates/default/admin/lib/tenant/forms/create-global-api-key.tsx +69 -0
- package/resources/templates/default/admin/lib/tenant/forms/global-roles-control.tsx +113 -0
- package/resources/templates/default/admin/lib/tenant/forms/index.ts +23 -8
- package/resources/templates/default/admin/lib/tenant/forms/invite.tsx +46 -8
- package/resources/templates/default/admin/lib/tenant/forms/login.tsx +8 -14
- package/resources/templates/default/admin/lib/tenant/forms/memberships-control.tsx +7 -5
- package/resources/templates/default/admin/lib/tenant/forms/mfa-code-fields.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/forms/password-reset-request.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/password-reset.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin-init.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/forms/passwordless-signin.tsx +8 -14
- package/resources/templates/default/admin/lib/tenant/forms/request-email-verification.tsx +35 -0
- package/resources/templates/default/admin/lib/tenant/forms/set-person-password.tsx +58 -0
- package/resources/templates/default/admin/lib/tenant/forms/set-project-secret.tsx +59 -0
- package/resources/templates/default/admin/lib/tenant/forms/sign-up.tsx +73 -0
- package/resources/templates/default/admin/lib/tenant/forms/update-project-member.tsx +14 -5
- package/resources/templates/default/admin/lib/tenant/forms/verify-email.tsx +38 -0
- package/resources/templates/default/admin/lib/tenant/hooks/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInvite.ts +41 -0
- package/resources/templates/default/admin/lib/tenant/hooks/useInviteUser.tsx +32 -3
- package/resources/templates/default/admin/lib/tenant/idp/identity-provider-connections.tsx +124 -0
- package/resources/templates/default/admin/lib/tenant/idp/index.ts +1 -0
- package/resources/templates/default/admin/lib/tenant/index.ts +10 -3
- package/resources/templates/default/admin/lib/tenant/listing/api-key-list.tsx +161 -23
- package/resources/templates/default/admin/lib/tenant/listing/auth-log-list.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/global-api-key-list.tsx +149 -0
- package/resources/templates/default/admin/lib/tenant/listing/index.ts +11 -4
- package/resources/templates/default/admin/lib/tenant/listing/member-delete-dialog.tsx +4 -4
- package/resources/templates/default/admin/lib/tenant/listing/member-list.tsx +28 -19
- package/resources/templates/default/admin/lib/tenant/listing/mfa.tsx +29 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-actions.tsx +179 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-detail.tsx +141 -0
- package/resources/templates/default/admin/lib/tenant/listing/person-list.tsx +17 -6
- package/resources/templates/default/admin/lib/tenant/listing/persons-list.tsx +128 -0
- package/resources/templates/default/admin/lib/tenant/listing/project-secret-list.tsx +82 -0
- package/resources/templates/default/admin/lib/tenant/otp/backup-codes.tsx +81 -0
- package/resources/templates/default/admin/lib/tenant/otp/email-otp-setup.tsx +133 -0
- package/resources/templates/default/admin/lib/tenant/otp/index.ts +3 -1
- package/resources/templates/default/admin/lib/tenant/otp/otp-setup.tsx +6 -6
- package/resources/templates/default/admin/lib/tenant/security/index.ts +2 -0
- package/resources/templates/default/admin/lib/tenant/security/passwordless-toggle.tsx +63 -0
- package/resources/templates/default/admin/lib/tenant/security/session-list.tsx +143 -0
- package/resources/templates/default/admin/lib/toast/index.ts +2 -2
- package/resources/templates/default/admin/lib/toast/toast.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/alert-dialog.tsx +114 -3
- package/resources/templates/default/admin/lib/ui/avatar.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/button.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/card.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/collapsible.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dialog.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/dimension.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/divider.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/dropdown.tsx +3 -3
- package/resources/templates/default/admin/lib/ui/input.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/label.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/loader.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/menu.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/overlay.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/popover.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/progress.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/property-list.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/scroll-area.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/select.tsx +44 -2
- package/resources/templates/default/admin/lib/ui/separator.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sheet.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/sidebar.tsx +8 -8
- package/resources/templates/default/admin/lib/ui/skeleton.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/sortable.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/switch.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/table.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/textarea.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/toggle-group.tsx +2 -2
- package/resources/templates/default/admin/lib/ui/toggle.tsx +1 -1
- package/resources/templates/default/admin/lib/ui/tooltip.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/dropzone.tsx +20 -3
- package/resources/templates/default/admin/lib/upload/index.ts +3 -3
- package/resources/templates/default/admin/lib/upload/repeater.tsx +5 -1
- package/resources/templates/default/admin/lib/upload/ui.tsx +2 -2
- package/resources/templates/default/admin/lib/upload/upload-progress.tsx +6 -6
- package/resources/templates/default/admin/lib/upload/view.tsx +4 -4
- package/resources/templates/default/admin/lib/utils/cn.ts +18 -0
- package/resources/templates/default/admin/lib/utils/createComponentOpenHooks.tsx +33 -0
- package/resources/templates/default/admin/lib/utils/index.ts +2 -2
- package/resources/templates/default/admin/lib/utils/uic.tsx +59 -0
- package/resources/templates/default/admin/lib/utils/use-mobile.ts +19 -0
- package/resources/templates/default/admin/package.json +1 -0
- package/resources/templates/default/docker/object-storage/README.md +13 -0
- package/resources/templates/default/docker/object-storage/identities.json +13 -0
- package/resources/templates/default/docker-compose.yaml +29 -7
- package/resources/templates/default/scripts/assemble-ui-lib.mjs +132 -0
- package/resources/templates/default/scripts/update-ui-lib.sh +101 -185
- package/src/commands/WorkspaceCreateCommand.ts +45 -17
- package/src/commands/index.ts +1 -1
- package/src/lib/FileSystem.ts +2 -2
- package/src/lib/TemplateInstaller.ts +87 -69
- package/src/lib/version.ts +1 -1
- package/src/run.ts +11 -10
- package/tests/cases/unit/create-process.test.ts +66 -0
- package/tests/cases/unit/template-installer-cleanup.test.ts +150 -0
- package/tests/cases/unit/workspace-create.test.ts +81 -0
|
@@ -1,17 +1,58 @@
|
|
|
1
1
|
import { Link, LogoutTrigger, useIdentity } from '@contember/interface'
|
|
2
|
-
import {
|
|
2
|
+
import { useProjectSlug } from '@contember/react-client'
|
|
3
|
+
import {
|
|
4
|
+
BadgeCheckIcon,
|
|
5
|
+
BellIcon,
|
|
6
|
+
ChevronsUpDown,
|
|
7
|
+
KeyRoundIcon,
|
|
8
|
+
LogOutIcon,
|
|
9
|
+
ScrollTextIcon,
|
|
10
|
+
SettingsIcon,
|
|
11
|
+
UserRoundIcon,
|
|
12
|
+
UsersIcon,
|
|
13
|
+
} from 'lucide-react'
|
|
3
14
|
import { dict } from '~/lib/dict'
|
|
4
15
|
import { Avatar, AvatarFallback } from '~/lib/ui/avatar'
|
|
5
16
|
import { AnchorButton, Button } from '~/lib/ui/button'
|
|
6
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
DropdownMenu,
|
|
19
|
+
DropdownMenuContent,
|
|
20
|
+
DropdownMenuGroup,
|
|
21
|
+
DropdownMenuItem,
|
|
22
|
+
DropdownMenuLabel,
|
|
23
|
+
DropdownMenuSeparator,
|
|
24
|
+
DropdownMenuTrigger,
|
|
25
|
+
} from '~/lib/ui/dropdown'
|
|
7
26
|
import { SidebarMenuButton } from '~/lib/ui/sidebar'
|
|
8
27
|
import { useIsMobile } from '~/lib/utils/use-mobile'
|
|
9
28
|
|
|
10
|
-
export const Navigation = () =>
|
|
29
|
+
export const Navigation = () => <div>Navigation</div>
|
|
11
30
|
|
|
12
31
|
export const UserNavigation = () => {
|
|
13
32
|
const isMobile = useIsMobile()
|
|
14
33
|
const identity = useIdentity()
|
|
34
|
+
const projectSlug = useProjectSlug()
|
|
35
|
+
const projectPermissions = identity?.projects.find(project => project.slug === projectSlug)?.permissions
|
|
36
|
+
const globalPermissions = identity?.permissions
|
|
37
|
+
// Hide an item only when the flags say it is refused. Unknown — identity still loading, or no
|
|
38
|
+
// project in scope so `projectPermissions` is undefined — shows it, matching `tenant.tsx` and the
|
|
39
|
+
// panel's own `mayPerform`. These flags exist to stop the UI promising what it cannot deliver, not
|
|
40
|
+
// to hide what it can, and gating on `=== true` makes the whole menu flicker in on every load.
|
|
41
|
+
const showApiKeys = projectPermissions?.canViewMembers !== false
|
|
42
|
+
|| projectPermissions?.canCreateApiKey !== false
|
|
43
|
+
|| globalPermissions?.canListGlobalApiKeys !== false
|
|
44
|
+
|| globalPermissions?.canCreateGlobalApiKey !== false
|
|
45
|
+
const showMembers = projectPermissions?.canViewMembers !== false
|
|
46
|
+
|| projectPermissions?.canAddMember !== false
|
|
47
|
+
|| projectPermissions?.canUpdateMember !== false
|
|
48
|
+
|| projectPermissions?.canRemoveMember !== false
|
|
49
|
+
const showPersons = globalPermissions?.canListPersons !== false
|
|
50
|
+
|| identity?.projects.some(project => project.permissions.canViewMembers) !== false
|
|
51
|
+
const showSecrets = projectPermissions?.canViewSecrets !== false || projectPermissions?.canSetSecret !== false
|
|
52
|
+
const showConfiguration = globalPermissions?.canViewConfiguration !== false
|
|
53
|
+
|| globalPermissions?.canManageConfiguration !== false
|
|
54
|
+
|| globalPermissions?.canListIdentityProviders !== false
|
|
55
|
+
|| globalPermissions?.canListMailTemplates !== false
|
|
15
56
|
|
|
16
57
|
const userEmail = identity?.person?.email
|
|
17
58
|
const userInitial = userEmail?.substring(0, 1).toLocaleUpperCase()
|
|
@@ -62,14 +103,60 @@ export const UserNavigation = () => {
|
|
|
62
103
|
</AnchorButton>
|
|
63
104
|
</Link>
|
|
64
105
|
</DropdownMenuItem>
|
|
65
|
-
|
|
66
|
-
<
|
|
106
|
+
{showApiKeys && (
|
|
107
|
+
<DropdownMenuItem>
|
|
108
|
+
<Link to="tenant/apiKeys">
|
|
109
|
+
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
110
|
+
<BellIcon size={16} />
|
|
111
|
+
API keys
|
|
112
|
+
</AnchorButton>
|
|
113
|
+
</Link>
|
|
114
|
+
</DropdownMenuItem>
|
|
115
|
+
)}
|
|
116
|
+
</DropdownMenuGroup>
|
|
117
|
+
<DropdownMenuSeparator />
|
|
118
|
+
<DropdownMenuLabel className="text-xs text-muted-foreground">Tenant</DropdownMenuLabel>
|
|
119
|
+
<DropdownMenuGroup>
|
|
120
|
+
{showMembers && <DropdownMenuItem>
|
|
121
|
+
<Link to="tenant/members">
|
|
67
122
|
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
68
|
-
<
|
|
69
|
-
|
|
123
|
+
<UsersIcon size={16} />
|
|
124
|
+
Members
|
|
70
125
|
</AnchorButton>
|
|
71
126
|
</Link>
|
|
72
|
-
</DropdownMenuItem>
|
|
127
|
+
</DropdownMenuItem>}
|
|
128
|
+
{showPersons && <DropdownMenuItem>
|
|
129
|
+
<Link to="tenant/persons">
|
|
130
|
+
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
131
|
+
<UserRoundIcon size={16} />
|
|
132
|
+
Persons
|
|
133
|
+
</AnchorButton>
|
|
134
|
+
</Link>
|
|
135
|
+
</DropdownMenuItem>}
|
|
136
|
+
{showSecrets && <DropdownMenuItem>
|
|
137
|
+
<Link to="tenant/projectSecrets">
|
|
138
|
+
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
139
|
+
<KeyRoundIcon size={16} />
|
|
140
|
+
Project secrets
|
|
141
|
+
</AnchorButton>
|
|
142
|
+
</Link>
|
|
143
|
+
</DropdownMenuItem>}
|
|
144
|
+
{globalPermissions?.canViewAuthLog === true && <DropdownMenuItem>
|
|
145
|
+
<Link to="tenant/auditLog">
|
|
146
|
+
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
147
|
+
<ScrollTextIcon size={16} />
|
|
148
|
+
Audit log
|
|
149
|
+
</AnchorButton>
|
|
150
|
+
</Link>
|
|
151
|
+
</DropdownMenuItem>}
|
|
152
|
+
{showConfiguration && <DropdownMenuItem>
|
|
153
|
+
<Link to="tenant/configuration">
|
|
154
|
+
<AnchorButton variant="ghost" size="xs" className="flex gap-2">
|
|
155
|
+
<SettingsIcon size={16} />
|
|
156
|
+
Configuration
|
|
157
|
+
</AnchorButton>
|
|
158
|
+
</Link>
|
|
159
|
+
</DropdownMenuItem>}
|
|
73
160
|
</DropdownMenuGroup>
|
|
74
161
|
<DropdownMenuSeparator />
|
|
75
162
|
<DropdownMenuItem>
|
|
@@ -1,19 +1,51 @@
|
|
|
1
1
|
import { useProjectSlug } from '@contember/react-client'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
AddProjectMemberForm,
|
|
4
|
+
ChangeMyPasswordForm,
|
|
5
|
+
ChangeMyProfileForm,
|
|
6
|
+
CreateApiKeyForm,
|
|
7
|
+
CreateGlobalApiKeyForm,
|
|
8
|
+
InviteForm,
|
|
9
|
+
SetProjectSecretForm,
|
|
10
|
+
useIdentity,
|
|
11
|
+
} from '@contember/react-identity'
|
|
12
|
+
import { KeyRoundIcon, LockKeyholeIcon, ScrollTextIcon, SettingsIcon, UserRoundIcon, UsersIcon } from 'lucide-react'
|
|
13
|
+
import { ReactNode, useRef, useState } from 'react'
|
|
5
14
|
import { Slots } from '~/lib/layout'
|
|
6
15
|
import {
|
|
16
|
+
AddProjectMemberFormFields,
|
|
7
17
|
ApiKeyList,
|
|
18
|
+
ApiKeyListController,
|
|
19
|
+
AuthLogList,
|
|
20
|
+
AuthPolicyList,
|
|
21
|
+
BackupCodes,
|
|
8
22
|
ChangeMyPasswordFormFields,
|
|
23
|
+
ChangeMyProfileFormFields,
|
|
9
24
|
CreateApiKeyFormFields,
|
|
25
|
+
CreateGlobalApiKeyFormFields,
|
|
26
|
+
EmailOtpSetup,
|
|
27
|
+
GlobalApiKeyList,
|
|
28
|
+
GlobalApiKeyListController,
|
|
29
|
+
IdentityProviderConnections,
|
|
30
|
+
IdentityProviderList,
|
|
10
31
|
InviteFormFields,
|
|
32
|
+
MailTemplateList,
|
|
11
33
|
MemberListController,
|
|
12
34
|
OtpSetup,
|
|
35
|
+
PasswordlessToggle,
|
|
36
|
+
PersonDetail,
|
|
13
37
|
PersonList,
|
|
38
|
+
PersonsList,
|
|
39
|
+
PersonsListController,
|
|
40
|
+
ProjectSecretList,
|
|
41
|
+
ProjectSecretListController,
|
|
42
|
+
SessionList,
|
|
43
|
+
SetProjectSecretFormFields,
|
|
44
|
+
TenantConfigView,
|
|
14
45
|
} from '~/lib/tenant'
|
|
15
46
|
import { ToastContent, useShowToast } from '~/lib/toast'
|
|
16
47
|
import { Card, CardContent, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
48
|
+
import { Dialog, DialogContent } from '~/lib/ui/dialog'
|
|
17
49
|
import { Input } from '~/lib/ui/input'
|
|
18
50
|
|
|
19
51
|
const Title = ({ icon, children }: { icon?: ReactNode; children: ReactNode }) => {
|
|
@@ -25,8 +57,19 @@ const Title = ({ icon, children }: { icon?: ReactNode; children: ReactNode }) =>
|
|
|
25
57
|
)
|
|
26
58
|
}
|
|
27
59
|
|
|
60
|
+
const Panel = ({ title, children }: { title: string; children: ReactNode }) => (
|
|
61
|
+
<Card className="w-[40rem] max-w-full">
|
|
62
|
+
<CardHeader>
|
|
63
|
+
<CardTitle className="text-2xl">{title}</CardTitle>
|
|
64
|
+
</CardHeader>
|
|
65
|
+
<CardContent>{children}</CardContent>
|
|
66
|
+
</Card>
|
|
67
|
+
)
|
|
68
|
+
|
|
28
69
|
export const Security = () => {
|
|
29
70
|
const showToast = useShowToast()
|
|
71
|
+
const identity = useIdentity()
|
|
72
|
+
const person = identity?.person
|
|
30
73
|
|
|
31
74
|
return (
|
|
32
75
|
<>
|
|
@@ -35,25 +78,53 @@ export const Security = () => {
|
|
|
35
78
|
</Slots.Title>
|
|
36
79
|
|
|
37
80
|
<div className="flex flex-col gap-4">
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
81
|
+
<Panel title="Profile">
|
|
82
|
+
{/* keyed on the identity values: the form snapshots initialValues on mount */}
|
|
83
|
+
<ChangeMyProfileForm
|
|
84
|
+
key={`${person?.email ?? ''} ${person?.name ?? ''}`}
|
|
85
|
+
initialValues={{ email: person?.email ?? '', name: person?.name ?? '' }}
|
|
86
|
+
onSuccess={() => showToast(<ToastContent>Profile updated</ToastContent>, { type: 'success' })}
|
|
87
|
+
>
|
|
88
|
+
<form className="grid gap-4">
|
|
89
|
+
<ChangeMyProfileFormFields />
|
|
90
|
+
</form>
|
|
91
|
+
</ChangeMyProfileForm>
|
|
92
|
+
</Panel>
|
|
93
|
+
|
|
94
|
+
<Panel title="Change password">
|
|
95
|
+
<ChangeMyPasswordForm onSuccess={() => showToast(<ToastContent>Password changed</ToastContent>, { type: 'success' })}>
|
|
96
|
+
<form className="grid gap-4">
|
|
97
|
+
<ChangeMyPasswordFormFields />
|
|
98
|
+
</form>
|
|
99
|
+
</ChangeMyPasswordForm>
|
|
100
|
+
</Panel>
|
|
101
|
+
|
|
102
|
+
<Panel title="Two-factor — authenticator app">
|
|
103
|
+
<OtpSetup />
|
|
104
|
+
</Panel>
|
|
105
|
+
|
|
106
|
+
<Panel title="Two-factor — e-mail code">
|
|
107
|
+
<EmailOtpSetup />
|
|
108
|
+
</Panel>
|
|
109
|
+
|
|
110
|
+
<Panel title="Backup codes">
|
|
111
|
+
<BackupCodes />
|
|
112
|
+
</Panel>
|
|
113
|
+
|
|
114
|
+
<Panel title="Passwordless sign-in">
|
|
115
|
+
<PasswordlessToggle />
|
|
116
|
+
</Panel>
|
|
117
|
+
|
|
118
|
+
<Panel title="Connected identity providers">
|
|
119
|
+
<IdentityProviderConnections />
|
|
120
|
+
</Panel>
|
|
121
|
+
|
|
122
|
+
<Card className="w-[60rem] max-w-full">
|
|
52
123
|
<CardHeader>
|
|
53
|
-
<CardTitle className="text-2xl">
|
|
124
|
+
<CardTitle className="text-2xl">Active sessions</CardTitle>
|
|
54
125
|
</CardHeader>
|
|
55
126
|
<CardContent>
|
|
56
|
-
<
|
|
127
|
+
<SessionList />
|
|
57
128
|
</CardContent>
|
|
58
129
|
</Card>
|
|
59
130
|
</div>
|
|
@@ -65,6 +136,8 @@ export const Members = () => {
|
|
|
65
136
|
const projectSlug = useProjectSlug()!
|
|
66
137
|
const showToast = useShowToast()
|
|
67
138
|
const memberListController = useRef<MemberListController>(undefined)
|
|
139
|
+
const identity = useIdentity()
|
|
140
|
+
const permissions = identity?.projects.find(project => project.slug === projectSlug)?.permissions
|
|
68
141
|
|
|
69
142
|
return (
|
|
70
143
|
<>
|
|
@@ -73,87 +146,265 @@ export const Members = () => {
|
|
|
73
146
|
</Slots.Title>
|
|
74
147
|
|
|
75
148
|
<div className="flex flex-col gap-4">
|
|
76
|
-
<
|
|
149
|
+
{permissions?.canAddMember !== false && <Panel title="Invite">
|
|
150
|
+
<InviteForm
|
|
151
|
+
projectSlug={projectSlug}
|
|
152
|
+
initialMemberships={[{ role: 'admin', variables: [] }]}
|
|
153
|
+
allowUnmanaged
|
|
154
|
+
onSuccess={args => {
|
|
155
|
+
showToast(<ToastContent>Member created: {args.result.person?.email}</ToastContent>, { type: 'success' })
|
|
156
|
+
memberListController.current?.refresh()
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<form>
|
|
160
|
+
{/* allowUnmanaged offers the "no invitation e-mail" path, for seeding and air-gapped setups */}
|
|
161
|
+
<InviteFormFields projectSlug={projectSlug} allowUnmanaged />
|
|
162
|
+
</form>
|
|
163
|
+
</InviteForm>
|
|
164
|
+
</Panel>}
|
|
165
|
+
|
|
166
|
+
{permissions?.canAddMember !== false && <Panel title="Add an existing identity">
|
|
167
|
+
<AddProjectMemberForm
|
|
168
|
+
projectSlug={projectSlug}
|
|
169
|
+
initialMemberships={[{ role: 'admin', variables: [] }]}
|
|
170
|
+
onSuccess={() => {
|
|
171
|
+
showToast(<ToastContent>Member added</ToastContent>, { type: 'success' })
|
|
172
|
+
memberListController.current?.refresh()
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
<form>
|
|
176
|
+
<AddProjectMemberFormFields projectSlug={projectSlug} />
|
|
177
|
+
</form>
|
|
178
|
+
</AddProjectMemberForm>
|
|
179
|
+
</Panel>}
|
|
180
|
+
|
|
181
|
+
{permissions?.canViewMembers !== false && <Card className="w-[60rem] max-w-full">
|
|
77
182
|
<CardHeader>
|
|
78
|
-
<CardTitle className="text-2xl">
|
|
183
|
+
<CardTitle className="text-2xl">Members</CardTitle>
|
|
79
184
|
</CardHeader>
|
|
80
185
|
<CardContent>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
<ToastContent>Invitation sent to {args.result.person?.email}</ToastContent>, { type: 'success' })
|
|
87
|
-
memberListController.current?.refresh()
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
<form>
|
|
91
|
-
<InviteFormFields projectSlug={projectSlug} />
|
|
92
|
-
</form>
|
|
93
|
-
</InviteForm>
|
|
186
|
+
<PersonList
|
|
187
|
+
controller={memberListController}
|
|
188
|
+
canUpdateMember={permissions?.canUpdateMember}
|
|
189
|
+
canRemoveMember={permissions?.canRemoveMember}
|
|
190
|
+
/>
|
|
94
191
|
</CardContent>
|
|
95
|
-
</Card>
|
|
96
|
-
|
|
192
|
+
</Card>}
|
|
193
|
+
</div>
|
|
194
|
+
</>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const ApiKeys = () => {
|
|
199
|
+
const projectSlug = useProjectSlug()!
|
|
200
|
+
const showToast = useShowToast()
|
|
201
|
+
const identity = useIdentity()
|
|
202
|
+
const permissions = identity?.projects.find(project => project.slug === projectSlug)?.permissions
|
|
203
|
+
const globalPermissions = identity?.permissions
|
|
204
|
+
const apiKeyListController = useRef<ApiKeyListController>(undefined)
|
|
205
|
+
const globalApiKeyListController = useRef<GlobalApiKeyListController>(undefined)
|
|
206
|
+
|
|
207
|
+
const showToken = (token?: string) => {
|
|
208
|
+
showToast(
|
|
209
|
+
<ToastContent title="API key created">
|
|
210
|
+
<Input value={token ?? ''} type="text" />
|
|
211
|
+
</ToastContent>,
|
|
212
|
+
{ type: 'success' },
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<>
|
|
218
|
+
<Slots.Title>
|
|
219
|
+
<Title icon={<KeyRoundIcon />}>API keys</Title>
|
|
220
|
+
</Slots.Title>
|
|
221
|
+
|
|
222
|
+
<div className="flex flex-col gap-4">
|
|
223
|
+
{permissions?.canCreateApiKey !== false && <Panel title="Create API key">
|
|
224
|
+
<CreateApiKeyForm
|
|
225
|
+
projectSlug={projectSlug}
|
|
226
|
+
initialMemberships={[{ role: 'admin', variables: [] }]}
|
|
227
|
+
onSuccess={args => {
|
|
228
|
+
showToken(args.result.apiKey.token)
|
|
229
|
+
apiKeyListController.current?.refresh()
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
232
|
+
<form className="grid gap-4">
|
|
233
|
+
<CreateApiKeyFormFields projectSlug={projectSlug} />
|
|
234
|
+
</form>
|
|
235
|
+
</CreateApiKeyForm>
|
|
236
|
+
</Panel>}
|
|
237
|
+
|
|
238
|
+
{permissions?.canViewMembers !== false && <Card className="w-[60rem] max-w-full">
|
|
97
239
|
<CardHeader>
|
|
98
|
-
<CardTitle className="text-2xl">
|
|
240
|
+
<CardTitle className="text-2xl">Project API keys</CardTitle>
|
|
99
241
|
</CardHeader>
|
|
100
242
|
<CardContent>
|
|
101
|
-
<
|
|
243
|
+
<ApiKeyList controller={apiKeyListController} />
|
|
102
244
|
</CardContent>
|
|
103
|
-
</Card>
|
|
245
|
+
</Card>}
|
|
104
246
|
|
|
247
|
+
{/* global keys carry tenant-wide roles instead of a project membership — SUPER_ADMIN only */}
|
|
248
|
+
{globalPermissions?.canCreateGlobalApiKey !== false && <Panel title="Create global API key">
|
|
249
|
+
<CreateGlobalApiKeyForm
|
|
250
|
+
onSuccess={args => {
|
|
251
|
+
showToken(args.result.apiKey.token)
|
|
252
|
+
globalApiKeyListController.current?.refresh()
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<form className="grid gap-4">
|
|
256
|
+
<CreateGlobalApiKeyFormFields />
|
|
257
|
+
</form>
|
|
258
|
+
</CreateGlobalApiKeyForm>
|
|
259
|
+
</Panel>}
|
|
260
|
+
|
|
261
|
+
{globalPermissions?.canListGlobalApiKeys !== false && <Card className="w-[60rem] max-w-full">
|
|
262
|
+
<CardHeader>
|
|
263
|
+
<CardTitle className="text-2xl">Global API keys</CardTitle>
|
|
264
|
+
</CardHeader>
|
|
265
|
+
<CardContent>
|
|
266
|
+
<GlobalApiKeyList controller={globalApiKeyListController} />
|
|
267
|
+
</CardContent>
|
|
268
|
+
</Card>}
|
|
105
269
|
</div>
|
|
106
270
|
</>
|
|
107
271
|
)
|
|
108
272
|
}
|
|
109
273
|
|
|
110
|
-
export const
|
|
274
|
+
export const Persons = () => {
|
|
275
|
+
const personsListController = useRef<PersonsListController>(undefined)
|
|
276
|
+
const [selectedPersonId, setSelectedPersonId] = useState<string>()
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<>
|
|
280
|
+
<Slots.Title>
|
|
281
|
+
<Title icon={<UserRoundIcon />}>Persons</Title>
|
|
282
|
+
</Slots.Title>
|
|
283
|
+
|
|
284
|
+
<Card className="w-[80rem] max-w-full">
|
|
285
|
+
<CardHeader>
|
|
286
|
+
<CardTitle className="text-2xl">Persons</CardTitle>
|
|
287
|
+
</CardHeader>
|
|
288
|
+
<CardContent>
|
|
289
|
+
<PersonsList controller={personsListController} onSelectPerson={setSelectedPersonId} />
|
|
290
|
+
</CardContent>
|
|
291
|
+
</Card>
|
|
292
|
+
|
|
293
|
+
<Dialog
|
|
294
|
+
open={selectedPersonId !== undefined}
|
|
295
|
+
onOpenChange={open => {
|
|
296
|
+
if (!open) {
|
|
297
|
+
setSelectedPersonId(undefined)
|
|
298
|
+
personsListController.current?.refresh()
|
|
299
|
+
}
|
|
300
|
+
}}
|
|
301
|
+
>
|
|
302
|
+
<DialogContent className="max-w-3xl max-h-[90vh] overflow-y-auto">
|
|
303
|
+
{selectedPersonId && <PersonDetail personId={selectedPersonId} />}
|
|
304
|
+
</DialogContent>
|
|
305
|
+
</Dialog>
|
|
306
|
+
</>
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export const AuditLog = () => (
|
|
311
|
+
<>
|
|
312
|
+
<Slots.Title>
|
|
313
|
+
<Title icon={<ScrollTextIcon />}>Audit log</Title>
|
|
314
|
+
</Slots.Title>
|
|
315
|
+
|
|
316
|
+
<Card className="w-[80rem] max-w-full">
|
|
317
|
+
<CardContent className="pt-6">
|
|
318
|
+
<AuthLogList />
|
|
319
|
+
</CardContent>
|
|
320
|
+
</Card>
|
|
321
|
+
</>
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
export const Configuration = () => (
|
|
325
|
+
<>
|
|
326
|
+
<Slots.Title>
|
|
327
|
+
<Title icon={<SettingsIcon />}>Configuration</Title>
|
|
328
|
+
</Slots.Title>
|
|
329
|
+
|
|
330
|
+
{/* Read-only throughout: all four areas are written with `contember tenant:apply`. */}
|
|
331
|
+
<div className="flex flex-col gap-4">
|
|
332
|
+
<Card className="w-[80rem] max-w-full">
|
|
333
|
+
<CardHeader>
|
|
334
|
+
<CardTitle className="text-2xl">Auth policies</CardTitle>
|
|
335
|
+
</CardHeader>
|
|
336
|
+
<CardContent>
|
|
337
|
+
<AuthPolicyList />
|
|
338
|
+
</CardContent>
|
|
339
|
+
</Card>
|
|
340
|
+
|
|
341
|
+
<Card className="w-[80rem] max-w-full">
|
|
342
|
+
<CardHeader>
|
|
343
|
+
<CardTitle className="text-2xl">Identity providers</CardTitle>
|
|
344
|
+
</CardHeader>
|
|
345
|
+
<CardContent>
|
|
346
|
+
<IdentityProviderList />
|
|
347
|
+
</CardContent>
|
|
348
|
+
</Card>
|
|
349
|
+
|
|
350
|
+
<Card className="w-[80rem] max-w-full">
|
|
351
|
+
<CardHeader>
|
|
352
|
+
<CardTitle className="text-2xl">Mail templates</CardTitle>
|
|
353
|
+
</CardHeader>
|
|
354
|
+
<CardContent>
|
|
355
|
+
<MailTemplateList />
|
|
356
|
+
</CardContent>
|
|
357
|
+
</Card>
|
|
358
|
+
|
|
359
|
+
<Card className="w-[80rem] max-w-full">
|
|
360
|
+
<CardHeader>
|
|
361
|
+
<CardTitle className="text-2xl">Tenant settings</CardTitle>
|
|
362
|
+
</CardHeader>
|
|
363
|
+
<CardContent>
|
|
364
|
+
<TenantConfigView />
|
|
365
|
+
</CardContent>
|
|
366
|
+
</Card>
|
|
367
|
+
</div>
|
|
368
|
+
</>
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
export const ProjectSecrets = () => {
|
|
111
372
|
const projectSlug = useProjectSlug()!
|
|
112
373
|
const showToast = useShowToast()
|
|
113
|
-
const
|
|
374
|
+
const secretListController = useRef<ProjectSecretListController>(undefined)
|
|
375
|
+
const identity = useIdentity()
|
|
376
|
+
const permissions = identity?.projects.find(project => project.slug === projectSlug)?.permissions
|
|
114
377
|
|
|
115
378
|
return (
|
|
116
379
|
<>
|
|
117
380
|
<Slots.Title>
|
|
118
|
-
<Title icon={<KeyRoundIcon />}>
|
|
381
|
+
<Title icon={<KeyRoundIcon />}>Project secrets</Title>
|
|
119
382
|
</Slots.Title>
|
|
120
383
|
|
|
121
384
|
<div className="flex flex-col gap-4">
|
|
122
|
-
<
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</Card>
|
|
146
|
-
</div>
|
|
147
|
-
<div>
|
|
148
|
-
<Card className="w-[40rem] max-w-full">
|
|
149
|
-
<CardHeader>
|
|
150
|
-
<CardTitle className="text-2xl">API keys</CardTitle>
|
|
151
|
-
</CardHeader>
|
|
152
|
-
<CardContent>
|
|
153
|
-
<ApiKeyList controller={memberListController} />
|
|
154
|
-
</CardContent>
|
|
155
|
-
</Card>
|
|
156
|
-
</div>
|
|
385
|
+
{permissions?.canSetSecret !== false && <Panel title="Set a secret">
|
|
386
|
+
<SetProjectSecretForm
|
|
387
|
+
projectSlug={projectSlug}
|
|
388
|
+
onSuccess={() => {
|
|
389
|
+
showToast(<ToastContent>Secret saved</ToastContent>, { type: 'success' })
|
|
390
|
+
secretListController.current?.refresh()
|
|
391
|
+
}}
|
|
392
|
+
>
|
|
393
|
+
<form className="grid gap-4">
|
|
394
|
+
<SetProjectSecretFormFields />
|
|
395
|
+
</form>
|
|
396
|
+
</SetProjectSecretForm>
|
|
397
|
+
</Panel>}
|
|
398
|
+
|
|
399
|
+
{permissions?.canViewSecrets !== false && <Card className="w-[60rem] max-w-full">
|
|
400
|
+
<CardHeader>
|
|
401
|
+
<CardTitle className="text-2xl">Secrets</CardTitle>
|
|
402
|
+
</CardHeader>
|
|
403
|
+
<CardContent>
|
|
404
|
+
{/* values are never readable — the API returns keys and timestamps only */}
|
|
405
|
+
<ProjectSecretList controller={secretListController} />
|
|
406
|
+
</CardContent>
|
|
407
|
+
</Card>}
|
|
157
408
|
</div>
|
|
158
409
|
</>
|
|
159
410
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToastContent, useShowToast } from '~/lib/toast'
|
|
2
|
-
import { dict } from '~/lib/dict'
|
|
2
|
+
import { dict } from '~/lib/tenant/dict'
|
|
3
3
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
4
4
|
import { AnchorButton, Button } from '~/lib/ui/button'
|
|
5
5
|
import { LoginFormFields } from '~/lib/tenant'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
2
|
-
import { dict } from '~/lib/dict'
|
|
2
|
+
import { dict } from '~/lib/tenant/dict'
|
|
3
3
|
import { Loader } from '~/lib/ui/loader'
|
|
4
4
|
import { PasswordlessSignInFormFields } from '~/lib/tenant/forms/passwordless-signin'
|
|
5
5
|
import { AnchorButton } from '~/lib/ui/button'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
2
|
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
3
|
-
import { dict } from '~/lib/dict'
|
|
3
|
+
import { dict } from '~/lib/tenant/dict'
|
|
4
4
|
import { PasswordlessSignInFormFields } from '~/lib/tenant/forms/passwordless-signin'
|
|
5
5
|
import { MailIcon } from 'lucide-react'
|
|
6
6
|
import { AnchorButton } from '~/lib/ui/button'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ToastContent, useShowToast } from '~/lib/toast'
|
|
2
2
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
3
|
-
import { dict } from '~/lib/dict'
|
|
3
|
+
import { dict } from '~/lib/tenant/dict'
|
|
4
4
|
import { PasswordResetFormFields } from '~/lib/tenant'
|
|
5
5
|
import { AnchorButton } from '~/lib/ui/button'
|
|
6
6
|
import { Link, useCurrentRequest, useRedirect } from '@contember/react-routing'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
2
|
-
import { dict } from '~/lib/dict'
|
|
2
|
+
import { dict } from '~/lib/tenant/dict'
|
|
3
3
|
import { PasswordResetRequestFormFields } from '~/lib/tenant'
|
|
4
4
|
import { AnchorButton } from '~/lib/ui/button'
|
|
5
5
|
import { Link, useRedirect } from '@contember/react-routing'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
|
|
2
|
-
import { dict } from '~/lib/dict'
|
|
2
|
+
import { dict } from '~/lib/tenant/dict'
|
|
3
3
|
import { MailIcon } from 'lucide-react'
|
|
4
4
|
import { AnchorButton } from '~/lib/ui/button'
|
|
5
5
|
import { Link } from '@contember/react-routing'
|