devpush 0.0.0-stage → 1.0.0-beta.3
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/README.md +6 -2
- package/agent-release.json +37 -0
- package/dist/package/LICENSE.md +21 -0
- package/dist/package/migrate.mjs +182 -0
- package/dist/package/plugins.mjs +125 -0
- package/dist/package/vite.mjs +439 -0
- package/package.json +170 -4
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.svg +1 -0
- package/public/logo-email.png +0 -0
- package/public/robots.txt +3 -0
- package/public/social.png +0 -0
- package/src/cloudflare-runtime.d.ts +78 -0
- package/src/components/about-dialog.tsx +70 -0
- package/src/components/copy-button.tsx +74 -0
- package/src/components/logo-mark.tsx +20 -0
- package/src/components/pending-collection.tsx +103 -0
- package/src/components/resource-avatar.tsx +65 -0
- package/src/components/route-error-state.tsx +95 -0
- package/src/components/section-navigation.tsx +39 -0
- package/src/components/settings-layout.tsx +111 -0
- package/src/components/storage-capabilities.tsx +11 -0
- package/src/components/table-pager.tsx +101 -0
- package/src/components/ui/alert-dialog.tsx +180 -0
- package/src/components/ui/alert.tsx +78 -0
- package/src/components/ui/avatar.tsx +58 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button-group.tsx +38 -0
- package/src/components/ui/button.tsx +67 -0
- package/src/components/ui/card.tsx +82 -0
- package/src/components/ui/chart.tsx +307 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/combobox.tsx +256 -0
- package/src/components/ui/dialog.tsx +163 -0
- package/src/components/ui/dropdown-menu.tsx +110 -0
- package/src/components/ui/empty.tsx +65 -0
- package/src/components/ui/field.tsx +192 -0
- package/src/components/ui/input-group.tsx +118 -0
- package/src/components/ui/input-otp.tsx +70 -0
- package/src/components/ui/input.tsx +19 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/pagination.tsx +34 -0
- package/src/components/ui/popover.tsx +86 -0
- package/src/components/ui/select.tsx +145 -0
- package/src/components/ui/skeleton.tsx +19 -0
- package/src/components/ui/sonner.tsx +47 -0
- package/src/components/ui/switch.tsx +31 -0
- package/src/components/ui/table.tsx +81 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/tooltip.tsx +55 -0
- package/src/features/admin/admin-settings.tsx +1048 -0
- package/src/features/auth/current-user-context-query.ts +11 -0
- package/src/features/auth/login-form.tsx +442 -0
- package/src/features/auth/sign-out-menu-item.tsx +42 -0
- package/src/features/deployments/deployment-actions.tsx +336 -0
- package/src/features/deployments/deployment-alias-badge.tsx +35 -0
- package/src/features/deployments/deployment-detail.tsx +596 -0
- package/src/features/deployments/deployment-filters.ts +66 -0
- package/src/features/deployments/deployment-list.tsx +465 -0
- package/src/features/deployments/deployment-visit-links.tsx +104 -0
- package/src/features/deployments/deployments-page.tsx +376 -0
- package/src/features/logs/log-scroll-area.tsx +69 -0
- package/src/features/notifications/email-preferences.tsx +232 -0
- package/src/features/onboarding/profile-onboarding.tsx +162 -0
- package/src/features/plugins/contributions.tsx +118 -0
- package/src/features/projects/backup-job-logs.tsx +143 -0
- package/src/features/projects/backup-policy-delete-dialog.tsx +82 -0
- package/src/features/projects/backup-restore-actions.tsx +573 -0
- package/src/features/projects/backup-status-icon.tsx +33 -0
- package/src/features/projects/backup-target-list.tsx +222 -0
- package/src/features/projects/backup-timestamp.tsx +32 -0
- package/src/features/projects/backup-volume-picker.tsx +158 -0
- package/src/features/projects/compose-service-input.tsx +64 -0
- package/src/features/projects/deploy-readiness.ts +28 -0
- package/src/features/projects/environment-dot.tsx +91 -0
- package/src/features/projects/log-keyword-filter.tsx +48 -0
- package/src/features/projects/manual-deploy-dialog.tsx +563 -0
- package/src/features/projects/pending-section.ts +26 -0
- package/src/features/projects/project-backup-details-pending.tsx +305 -0
- package/src/features/projects/project-backup-details.tsx +936 -0
- package/src/features/projects/project-backup-policy.tsx +644 -0
- package/src/features/projects/project-backup-utils.ts +190 -0
- package/src/features/projects/project-backups-pending.tsx +136 -0
- package/src/features/projects/project-backups.tsx +876 -0
- package/src/features/projects/project-environment-settings.tsx +1128 -0
- package/src/features/projects/project-heading.tsx +68 -0
- package/src/features/projects/project-layout.tsx +188 -0
- package/src/features/projects/project-logs.tsx +461 -0
- package/src/features/projects/project-overview.tsx +280 -0
- package/src/features/projects/project-route-pending.tsx +1064 -0
- package/src/features/projects/project-routing-settings.tsx +663 -0
- package/src/features/projects/project-settings-section.tsx +64 -0
- package/src/features/projects/project-settings-utils.ts +101 -0
- package/src/features/projects/project-settings.tsx +1472 -0
- package/src/features/projects/repository-picker-dialog.tsx +404 -0
- package/src/features/repositories/new-project-dialog-launcher.tsx +44 -0
- package/src/features/repositories/new-project-dialog.tsx +1204 -0
- package/src/features/repositories/new-project-pending.tsx +28 -0
- package/src/features/repositories/repository-list-pending.tsx +59 -0
- package/src/features/servers/server-availability-alert.tsx +44 -0
- package/src/features/servers/server-availability.ts +29 -0
- package/src/features/servers/server-avatar.tsx +52 -0
- package/src/features/servers/server-detail-pending.tsx +315 -0
- package/src/features/servers/server-detail.tsx +855 -0
- package/src/features/servers/server-metric-chart-pending.tsx +38 -0
- package/src/features/servers/server-metric-chart.tsx +182 -0
- package/src/features/servers/server-metric-format.ts +50 -0
- package/src/features/servers/server-metrics-pending.tsx +75 -0
- package/src/features/servers/server-metrics.tsx +136 -0
- package/src/features/servers/team-servers.tsx +432 -0
- package/src/features/settings/settings-route-pending.tsx +406 -0
- package/src/features/teams/backup-storage-settings.tsx +483 -0
- package/src/features/teams/navigation.ts +51 -0
- package/src/features/teams/new-team-dialog.tsx +132 -0
- package/src/features/teams/pending-section.ts +19 -0
- package/src/features/teams/team-header.tsx +1286 -0
- package/src/features/teams/team-heading.tsx +57 -0
- package/src/features/teams/team-home.tsx +391 -0
- package/src/features/teams/team-invite.tsx +155 -0
- package/src/features/teams/team-route-pending.tsx +505 -0
- package/src/features/teams/team-settings.tsx +1555 -0
- package/src/features/teams/use-workspace-updates.ts +126 -0
- package/src/features/users/api-keys-settings.tsx +544 -0
- package/src/features/users/api-scope-selection.tsx +269 -0
- package/src/features/users/connected-apps-settings.tsx +449 -0
- package/src/features/users/mcp-consent.tsx +220 -0
- package/src/features/users/profile-picture.tsx +171 -0
- package/src/features/users/user-settings.tsx +1064 -0
- package/src/lib/account-settings-schema.ts +78 -0
- package/src/lib/action-feedback.ts +81 -0
- package/src/lib/admin-search-schema.ts +8 -0
- package/src/lib/agent-release.d.mts +21 -0
- package/src/lib/agent-release.mjs +90 -0
- package/src/lib/allowlist-schema.ts +79 -0
- package/src/lib/api-key-schema.ts +176 -0
- package/src/lib/auth/client.ts +20 -0
- package/src/lib/avatar-schema.ts +11 -0
- package/src/lib/backup-cron.ts +118 -0
- package/src/lib/backup-database.ts +41 -0
- package/src/lib/backup-feature.ts +2 -0
- package/src/lib/backup-paths.ts +7 -0
- package/src/lib/backup-policy-schema.ts +85 -0
- package/src/lib/backup-resource-schema.ts +12 -0
- package/src/lib/backup-restore-schema.ts +15 -0
- package/src/lib/backup-storage-schema.ts +55 -0
- package/src/lib/deferred-module.ts +38 -0
- package/src/lib/deployment-logs-query.ts +63 -0
- package/src/lib/display-name.ts +7 -0
- package/src/lib/error-message.ts +119 -0
- package/src/lib/form-errors.ts +10 -0
- package/src/lib/internal-redirect.ts +25 -0
- package/src/lib/manual-deploy-options-query.ts +21 -0
- package/src/lib/notification-preferences.ts +43 -0
- package/src/lib/onboarding.ts +11 -0
- package/src/lib/operation-logs-query.ts +51 -0
- package/src/lib/page-head.ts +14 -0
- package/src/lib/project-context-query.ts +257 -0
- package/src/lib/project-creation-schema.ts +64 -0
- package/src/lib/project-env-schema.ts +23 -0
- package/src/lib/project-environments-schema.ts +56 -0
- package/src/lib/project-routing-schema.ts +94 -0
- package/src/lib/project-runtime-config.ts +131 -0
- package/src/lib/project-settings-schema.ts +75 -0
- package/src/lib/public-api-schema.ts +128 -0
- package/src/lib/public-error.ts +337 -0
- package/src/lib/query.ts +13 -0
- package/src/lib/repository-selection-query.ts +11 -0
- package/src/lib/resource-cache.ts +30 -0
- package/src/lib/runtime-id.ts +19 -0
- package/src/lib/search.ts +14 -0
- package/src/lib/server-context-query.ts +43 -0
- package/src/lib/server-name-schema.ts +11 -0
- package/src/lib/settings-conflict.ts +45 -0
- package/src/lib/settings-version.ts +7 -0
- package/src/lib/team-context-query.ts +126 -0
- package/src/lib/team-context-schema.ts +8 -0
- package/src/lib/team-forms-schema.ts +45 -0
- package/src/lib/team-role.ts +13 -0
- package/src/lib/team-settings-schema.ts +48 -0
- package/src/lib/urls.ts +3 -0
- package/src/lib/use-avatar-input.ts +61 -0
- package/src/lib/use-refresh-error.ts +18 -0
- package/src/lib/use-settings-version.ts +23 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/validation.ts +5 -0
- package/src/lib/workspace-updates.ts +53 -0
- package/src/package/config.ts +10 -0
- package/src/package/env.mjs +54 -0
- package/src/package/migrate-api.d.ts +5 -0
- package/src/package/migrate.ts +56 -0
- package/src/package/plugins.ts +141 -0
- package/src/package/sqlite.mjs +2 -0
- package/src/package/vite-api.d.ts +5 -0
- package/src/package/vite.ts +324 -0
- package/src/package/watch-guard.cjs +26 -0
- package/src/plugins/client.ts +57 -0
- package/src/plugins/contract.ts +188 -0
- package/src/plugins/default.server.ts +4 -0
- package/src/plugins/default.ui.ts +4 -0
- package/src/plugins/operations.ts +45 -0
- package/src/plugins/server.ts +197 -0
- package/src/plugins/version.ts +1 -0
- package/src/routeTree.gen.ts +1275 -0
- package/src/router.tsx +46 -0
- package/src/routes/$teamSlug.index.tsx +53 -0
- package/src/routes/$teamSlug.new-project.tsx +13 -0
- package/src/routes/$teamSlug.projects.$projectName.backups.$backupId.tsx +40 -0
- package/src/routes/$teamSlug.projects.$projectName.backups.tsx +82 -0
- package/src/routes/$teamSlug.projects.$projectName.deployments.$deploymentId.tsx +52 -0
- package/src/routes/$teamSlug.projects.$projectName.deployments.tsx +86 -0
- package/src/routes/$teamSlug.projects.$projectName.logs.tsx +55 -0
- package/src/routes/$teamSlug.projects.$projectName.settings.tsx +51 -0
- package/src/routes/$teamSlug.projects.$projectName.tsx +106 -0
- package/src/routes/$teamSlug.projects.tsx +40 -0
- package/src/routes/$teamSlug.servers.$serverId.tsx +31 -0
- package/src/routes/$teamSlug.servers.index.tsx +59 -0
- package/src/routes/$teamSlug.servers.tsx +7 -0
- package/src/routes/$teamSlug.settings.tsx +56 -0
- package/src/routes/$teamSlug.tsx +86 -0
- package/src/routes/[.]well-known.oauth-authorization-server.api.auth.ts +13 -0
- package/src/routes/[.]well-known.oauth-protected-resource.mcp.ts +6 -0
- package/src/routes/__root.tsx +155 -0
- package/src/routes/admin.tsx +55 -0
- package/src/routes/api/agents/certificates.ts +21 -0
- package/src/routes/api/agents/credentials/rotate.ts +22 -0
- package/src/routes/api/agents/heartbeat.ts +42 -0
- package/src/routes/api/agents/job-logs.ts +22 -0
- package/src/routes/api/agents/jobs/complete.ts +22 -0
- package/src/routes/api/agents/jobs/next.ts +29 -0
- package/src/routes/api/agents/jobs/progress.ts +32 -0
- package/src/routes/api/agents/jobs/status.ts +22 -0
- package/src/routes/api/agents/register.ts +45 -0
- package/src/routes/api/agents/runtime-logs.ts +22 -0
- package/src/routes/api/agents/switch.ts +25 -0
- package/src/routes/api/auth/$.ts +38 -0
- package/src/routes/api/cron/backups.ts +33 -0
- package/src/routes/api/cron/maintenance.ts +30 -0
- package/src/routes/api/github/install.callback.ts +51 -0
- package/src/routes/api/github/install.ts +41 -0
- package/src/routes/api/github/webhook.ts +11 -0
- package/src/routes/api/health.ts +19 -0
- package/src/routes/api/install/agent.$token.ts +50 -0
- package/src/routes/api/install/agent.binary.ts +83 -0
- package/src/routes/api/install/agent.checksum.ts +45 -0
- package/src/routes/api/install/agent.ts +26 -0
- package/src/routes/api/plugins/$.ts +11 -0
- package/src/routes/api/v1/$.ts +15 -0
- package/src/routes/api/workspaces/updates.ts +8 -0
- package/src/routes/auth.login.tsx +50 -0
- package/src/routes/deployments.$deploymentId.unavailable.tsx +21 -0
- package/src/routes/index.tsx +23 -0
- package/src/routes/invites.$token.tsx +35 -0
- package/src/routes/mcp.ts +13 -0
- package/src/routes/oauth.consent.tsx +54 -0
- package/src/routes/onboarding.tsx +37 -0
- package/src/routes/onboarding.workspace.tsx +44 -0
- package/src/routes/settings.tsx +30 -0
- package/src/routes/uploads/avatars/$fileName.ts +44 -0
- package/src/server/admin/access.ts +67 -0
- package/src/server/admin/functions.ts +122 -0
- package/src/server/admin/service.ts +260 -0
- package/src/server/agents/backup-state.ts +210 -0
- package/src/server/agents/certificates.ts +96 -0
- package/src/server/agents/claims.ts +116 -0
- package/src/server/agents/cleanup.ts +52 -0
- package/src/server/agents/compatibility.ts +116 -0
- package/src/server/agents/completion.ts +83 -0
- package/src/server/agents/container-cleanup-state.ts +51 -0
- package/src/server/agents/deployment-state.ts +111 -0
- package/src/server/agents/job-payloads.ts +159 -0
- package/src/server/agents/jobs.ts +1293 -0
- package/src/server/agents/protocol.ts +400 -0
- package/src/server/agents/reconciliation.ts +43 -0
- package/src/server/agents/runtime-logs.ts +337 -0
- package/src/server/agents/runtime-state.ts +125 -0
- package/src/server/api/admission.ts +12 -0
- package/src/server/api/authorization.ts +115 -0
- package/src/server/api/credentials.ts +569 -0
- package/src/server/api/cursors.ts +72 -0
- package/src/server/api/errors.ts +24 -0
- package/src/server/api/functions.ts +60 -0
- package/src/server/api/handler.ts +274 -0
- package/src/server/api/mutation-operations.ts +913 -0
- package/src/server/api/operation-context.ts +139 -0
- package/src/server/api/operation-contract.ts +1099 -0
- package/src/server/api/operations.ts +64 -0
- package/src/server/api/read-operations.ts +891 -0
- package/src/server/api/retention.ts +33 -0
- package/src/server/auth/access.ts +109 -0
- package/src/server/auth/auth-methods.ts +28 -0
- package/src/server/auth/better-auth.ts +518 -0
- package/src/server/auth/context.ts +28 -0
- package/src/server/auth/email-change.ts +47 -0
- package/src/server/auth/email-delivery.ts +51 -0
- package/src/server/auth/provider-identity.ts +19 -0
- package/src/server/auth/provider-tokens.ts +27 -0
- package/src/server/auth/session.server.ts +19 -0
- package/src/server/backups/database-commands.ts +40 -0
- package/src/server/backups/destination.ts +12 -0
- package/src/server/backups/feature.ts +6 -0
- package/src/server/backups/policy-validation.ts +51 -0
- package/src/server/backups/queue-state.ts +137 -0
- package/src/server/backups/service.ts +918 -0
- package/src/server/backups/storage-functions.ts +42 -0
- package/src/server/backups/storage-state.ts +67 -0
- package/src/server/backups/storage.ts +237 -0
- package/src/server/config.ts +274 -0
- package/src/server/db/atomic.ts +16 -0
- package/src/server/db/d1-connection.ts +83 -0
- package/src/server/db/errors.ts +17 -0
- package/src/server/db/index.cloudflare.ts +15 -0
- package/src/server/db/index.ts +35 -0
- package/src/server/db/libsql-connection.ts +72 -0
- package/src/server/db/log-schema.ts +102 -0
- package/src/server/db/migrate-libsql.ts +29 -0
- package/src/server/db/migrate-sqlite.ts +47 -0
- package/src/server/db/migration-history.ts +12 -0
- package/src/server/db/migrations-logs/0000_initial.sql +48 -0
- package/src/server/db/migrations-logs/0001_runtime_log_order.sql +2 -0
- package/src/server/db/migrations-logs/meta/0000_snapshot.json +327 -0
- package/src/server/db/migrations-logs/meta/0001_snapshot.json +329 -0
- package/src/server/db/migrations-logs/meta/_journal.json +20 -0
- package/src/server/db/migrations-sqlite/0000_initial.sql +894 -0
- package/src/server/db/migrations-sqlite/0001_agent_indexes.sql +5 -0
- package/src/server/db/migrations-sqlite/meta/0000_snapshot.json +5816 -0
- package/src/server/db/migrations-sqlite/meta/0001_snapshot.json +5841 -0
- package/src/server/db/migrations-sqlite/meta/_journal.json +20 -0
- package/src/server/db/oauth-schema.ts +216 -0
- package/src/server/db/remote-config.ts +47 -0
- package/src/server/db/schema.ts +1218 -0
- package/src/server/db/sqlite-connection.ts +94 -0
- package/src/server/db/sqlite-files.ts +27 -0
- package/src/server/db/sqlite-params.ts +19 -0
- package/src/server/db/worker-connection.ts +47 -0
- package/src/server/deleted-resources.ts +133 -0
- package/src/server/deletion-recovery.ts +272 -0
- package/src/server/email/layout.tsx +85 -0
- package/src/server/email/notification-template.tsx +62 -0
- package/src/server/email/otp-template.tsx +48 -0
- package/src/server/email/service.ts +251 -0
- package/src/server/email/team-invite-template.tsx +59 -0
- package/src/server/email/theme.ts +10 -0
- package/src/server/github/http.ts +14 -0
- package/src/server/github/install-state.ts +48 -0
- package/src/server/github/service.ts +831 -0
- package/src/server/github/webhook-handler.ts +198 -0
- package/src/server/github/webhooks.ts +205 -0
- package/src/server/http/auth.ts +11 -0
- package/src/server/http/error-diagnostics.ts +66 -0
- package/src/server/http/plugin-request.ts +15 -0
- package/src/server/http/proxy-request.ts +53 -0
- package/src/server/http/public-errors.ts +48 -0
- package/src/server/http/rate-limit.ts +59 -0
- package/src/server/http/request-body.ts +54 -0
- package/src/server/http/request-ip.ts +54 -0
- package/src/server/http/security-headers.ts +36 -0
- package/src/server/install/agent-binary.ts +230 -0
- package/src/server/install/agent-script.ts +565 -0
- package/src/server/install/release-binary.ts +65 -0
- package/src/server/logs/budget.ts +72 -0
- package/src/server/logs/cleanup.ts +64 -0
- package/src/server/logs/deployments.ts +98 -0
- package/src/server/logs/operations.ts +145 -0
- package/src/server/logs/retention.ts +39 -0
- package/src/server/maintenance.ts +61 -0
- package/src/server/mcp/connections.ts +358 -0
- package/src/server/mcp/functions.ts +63 -0
- package/src/server/mcp/handler.ts +295 -0
- package/src/server/mcp/oauth-discovery.cloudflare.ts +6 -0
- package/src/server/mcp/oauth-discovery.ts +8 -0
- package/src/server/mcp/oauth-provider.ts +220 -0
- package/src/server/mcp/urls.ts +20 -0
- package/src/server/notifications/functions.ts +51 -0
- package/src/server/notifications/observe.ts +303 -0
- package/src/server/notifications/outbox.ts +335 -0
- package/src/server/notifications/preferences.ts +131 -0
- package/src/server/notifications/query.ts +16 -0
- package/src/server/plugins/scope.ts +17 -0
- package/src/server/plugins/server-context.ts +157 -0
- package/src/server/plugins/services.server.ts +10 -0
- package/src/server/plugins/workspace-access.ts +74 -0
- package/src/server/projects/backup-policy-state.ts +68 -0
- package/src/server/projects/backups.ts +219 -0
- package/src/server/projects/compose-metadata.ts +174 -0
- package/src/server/projects/configuration-state.ts +90 -0
- package/src/server/projects/context.ts +909 -0
- package/src/server/projects/creation-state.ts +46 -0
- package/src/server/projects/deletion-state.ts +69 -0
- package/src/server/projects/deployment-config.ts +139 -0
- package/src/server/projects/deployment-logs.ts +97 -0
- package/src/server/projects/deployments.ts +1123 -0
- package/src/server/projects/domain-state.ts +71 -0
- package/src/server/projects/environment-branches.ts +75 -0
- package/src/server/projects/environment-state.ts +158 -0
- package/src/server/projects/environments.ts +424 -0
- package/src/server/projects/functions.ts +748 -0
- package/src/server/projects/generated-hostname.ts +77 -0
- package/src/server/projects/hostnames.ts +244 -0
- package/src/server/projects/mappers.ts +457 -0
- package/src/server/projects/names.ts +41 -0
- package/src/server/projects/project-env-vars.ts +28 -0
- package/src/server/projects/queue-state.ts +118 -0
- package/src/server/projects/repository.ts +368 -0
- package/src/server/projects/route-state.ts +37 -0
- package/src/server/projects/runtime-logs.ts +97 -0
- package/src/server/projects/settings-context.ts +58 -0
- package/src/server/projects/settings.ts +738 -0
- package/src/server/projects/types.ts +355 -0
- package/src/server/realtime/agent-events.ts +32 -0
- package/src/server/realtime/node-broadcaster.ts +71 -0
- package/src/server/realtime/node-handler.ts +55 -0
- package/src/server/realtime/service.ts +125 -0
- package/src/server/realtime/workspace-object.cloudflare.ts +62 -0
- package/src/server/realtime/workspace-object.ts +3 -0
- package/src/server/resources/color.ts +13 -0
- package/src/server/runtime/background.ts +21 -0
- package/src/server/runtime/node-asset-cache-plugin.ts +12 -0
- package/src/server/runtime/node-scheduler-plugin.ts +17 -0
- package/src/server/runtime/node-scheduler.ts +51 -0
- package/src/server/runtime/platform-env.cloudflare.ts +17 -0
- package/src/server/runtime/platform-env.ts +19 -0
- package/src/server/runtime/scheduled-task-error.ts +9 -0
- package/src/server/scheduled-tasks.ts +28 -0
- package/src/server/secrets/crypto.ts +56 -0
- package/src/server/servers/functions.ts +233 -0
- package/src/server/servers/lifecycle.ts +122 -0
- package/src/server/servers/metric-history-schema.ts +24 -0
- package/src/server/servers/metric-history.ts +55 -0
- package/src/server/servers/monitoring.ts +592 -0
- package/src/server/servers/service.ts +1211 -0
- package/src/server/servers/status.ts +32 -0
- package/src/server/servers/switch.ts +96 -0
- package/src/server/settings-version.ts +43 -0
- package/src/server/storage/capabilities.ts +6 -0
- package/src/server/storage/local-object-store.cloudflare.ts +7 -0
- package/src/server/storage/local-object-store.ts +50 -0
- package/src/server/storage/object-store.ts +160 -0
- package/src/server/teams/creation.ts +51 -0
- package/src/server/teams/delete-policy.ts +13 -0
- package/src/server/teams/deletion-state.ts +80 -0
- package/src/server/teams/functions.ts +324 -0
- package/src/server/teams/invitations.ts +38 -0
- package/src/server/teams/membership.ts +86 -0
- package/src/server/teams/queries.ts +261 -0
- package/src/server/teams/service.ts +1127 -0
- package/src/server/teams/types.ts +101 -0
- package/src/server/uploads/avatar.ts +133 -0
- package/src/server/users/deletion-state.ts +93 -0
- package/src/server/users/functions.ts +160 -0
- package/src/server/users/onboarding.ts +17 -0
- package/src/server/users/service.ts +644 -0
- package/src/server.ts +55 -0
- package/src/styles/shadcn.css +653 -0
- package/src/styles/theme.css +76 -0
- package/src/styles.css +177 -0
- package/wrangler.template.jsonc +37 -0
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { LoaderIcon } from 'lucide-react'
|
|
4
|
+
import {
|
|
5
|
+
databaseArtifactTarget,
|
|
6
|
+
backupDatabaseEngines,
|
|
7
|
+
} from '#devpush/lib/backup-database'
|
|
8
|
+
import { backupRestoreArtifactSchema } from '#devpush/lib/backup-restore-schema'
|
|
9
|
+
import { getPublicErrorMessage } from '#devpush/lib/public-error'
|
|
10
|
+
import { Button } from '#devpush/components/ui/button'
|
|
11
|
+
import { BackupTimestamp } from './backup-timestamp'
|
|
12
|
+
import { EnvironmentDot } from './environment-dot'
|
|
13
|
+
import { ServerAvatar } from '#devpush/features/servers/server-avatar'
|
|
14
|
+
import type { ServerStatus } from '#devpush/server/servers/status'
|
|
15
|
+
import {
|
|
16
|
+
Tooltip,
|
|
17
|
+
TooltipTrigger,
|
|
18
|
+
TooltipContent,
|
|
19
|
+
} from '#devpush/components/ui/tooltip'
|
|
20
|
+
import { BackupStatusIcon } from './backup-status-icon'
|
|
21
|
+
import { Checkbox } from '#devpush/components/ui/checkbox'
|
|
22
|
+
import {
|
|
23
|
+
Dialog,
|
|
24
|
+
DialogContent,
|
|
25
|
+
DialogDescription,
|
|
26
|
+
DialogFooter,
|
|
27
|
+
DialogHeader,
|
|
28
|
+
DialogTitle,
|
|
29
|
+
} from '#devpush/components/ui/dialog'
|
|
30
|
+
import { FieldError } from '#devpush/components/ui/field'
|
|
31
|
+
import type {
|
|
32
|
+
ProjectBackupArtifact,
|
|
33
|
+
ProjectBackupRestore,
|
|
34
|
+
ProjectBackupRun,
|
|
35
|
+
} from '#devpush/server/projects/types'
|
|
36
|
+
import {
|
|
37
|
+
formatBytes,
|
|
38
|
+
formatBackupStatus,
|
|
39
|
+
getComposeArtifactName,
|
|
40
|
+
getComposeVolumeName,
|
|
41
|
+
} from './project-backup-utils'
|
|
42
|
+
import type { z } from 'zod'
|
|
43
|
+
|
|
44
|
+
export type BackupRestoreSelection = z.infer<typeof backupRestoreArtifactSchema>
|
|
45
|
+
type Restore = (input: {
|
|
46
|
+
run: ProjectBackupRun
|
|
47
|
+
artifacts: BackupRestoreSelection[]
|
|
48
|
+
}) => Promise<void>
|
|
49
|
+
|
|
50
|
+
function restoreContents(
|
|
51
|
+
artifacts: ProjectBackupArtifact[],
|
|
52
|
+
run: ProjectBackupRun,
|
|
53
|
+
projectId: string,
|
|
54
|
+
) {
|
|
55
|
+
const contents = new Map<
|
|
56
|
+
string,
|
|
57
|
+
{
|
|
58
|
+
artifact: ProjectBackupArtifact
|
|
59
|
+
name: string
|
|
60
|
+
database?: ReturnType<typeof databaseArtifactTarget>
|
|
61
|
+
}
|
|
62
|
+
>()
|
|
63
|
+
for (const artifact of artifacts) {
|
|
64
|
+
if (
|
|
65
|
+
run.localRecoveryAvailable &&
|
|
66
|
+
run.status !== 'succeeded' &&
|
|
67
|
+
artifact.storage !== 'local'
|
|
68
|
+
)
|
|
69
|
+
continue
|
|
70
|
+
const database =
|
|
71
|
+
artifact.type === 'database'
|
|
72
|
+
? databaseArtifactTarget(artifact.objectKey, run.databaseTargets ?? [])
|
|
73
|
+
: undefined
|
|
74
|
+
if (artifact.type !== 'volume' && !database) continue
|
|
75
|
+
const name = getComposeArtifactName(artifact, projectId, run.environmentId)
|
|
76
|
+
// Local and remote copies share the same generated filename. Keep one target,
|
|
77
|
+
// preferring the recorded local copy; remote-only contents remain restorable.
|
|
78
|
+
const key = `${artifact.type}:${artifact.objectKey.split('/').at(-1)}`
|
|
79
|
+
const current = contents.get(key)
|
|
80
|
+
if (!current || artifact.storage === 'local')
|
|
81
|
+
contents.set(key, { artifact, name, database })
|
|
82
|
+
}
|
|
83
|
+
return [...contents.values()]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function BackupRunRestoreActions({
|
|
87
|
+
projectId,
|
|
88
|
+
policyName,
|
|
89
|
+
targetServerName,
|
|
90
|
+
targetServerStatus,
|
|
91
|
+
artifacts,
|
|
92
|
+
disabled,
|
|
93
|
+
restoringRunId,
|
|
94
|
+
run,
|
|
95
|
+
onRestore,
|
|
96
|
+
}: {
|
|
97
|
+
projectId: string
|
|
98
|
+
policyName?: string
|
|
99
|
+
targetServerName?: string
|
|
100
|
+
targetServerStatus?: ServerStatus
|
|
101
|
+
artifacts: ProjectBackupArtifact[]
|
|
102
|
+
disabled: boolean
|
|
103
|
+
restoringRunId: string | null
|
|
104
|
+
run: ProjectBackupRun
|
|
105
|
+
onRestore: Restore
|
|
106
|
+
}) {
|
|
107
|
+
const [open, setOpen] = useState(false)
|
|
108
|
+
const contents = restoreContents(artifacts, run, projectId)
|
|
109
|
+
if (run.status !== 'succeeded' && !run.localRecoveryAvailable) return <span />
|
|
110
|
+
if (!contents.length)
|
|
111
|
+
return artifacts.some((a) => a.type === 'database') ? (
|
|
112
|
+
<span
|
|
113
|
+
className="text-xs text-muted-foreground"
|
|
114
|
+
title="This backup has no supported engine metadata. Restore the file manually."
|
|
115
|
+
>
|
|
116
|
+
Manual restore required
|
|
117
|
+
</span>
|
|
118
|
+
) : (
|
|
119
|
+
<span />
|
|
120
|
+
)
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<Button
|
|
124
|
+
type="button"
|
|
125
|
+
variant="outline"
|
|
126
|
+
size="sm"
|
|
127
|
+
aria-label="Restore"
|
|
128
|
+
disabled={disabled}
|
|
129
|
+
onClick={() => setOpen(true)}
|
|
130
|
+
>
|
|
131
|
+
Restore
|
|
132
|
+
</Button>
|
|
133
|
+
{open ? (
|
|
134
|
+
<RestoreBackupDialog
|
|
135
|
+
contents={contents}
|
|
136
|
+
policyName={policyName}
|
|
137
|
+
targetServerName={targetServerName}
|
|
138
|
+
targetServerStatus={targetServerStatus}
|
|
139
|
+
run={run}
|
|
140
|
+
isRestoring={restoringRunId === run.id}
|
|
141
|
+
onClose={() => setOpen(false)}
|
|
142
|
+
onRestore={onRestore}
|
|
143
|
+
/>
|
|
144
|
+
) : null}
|
|
145
|
+
</>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function RestoreBackupDialog({
|
|
150
|
+
contents,
|
|
151
|
+
policyName,
|
|
152
|
+
targetServerName,
|
|
153
|
+
targetServerStatus,
|
|
154
|
+
run,
|
|
155
|
+
isRestoring,
|
|
156
|
+
onClose,
|
|
157
|
+
onRestore,
|
|
158
|
+
}: {
|
|
159
|
+
contents: ReturnType<typeof restoreContents>
|
|
160
|
+
policyName?: string
|
|
161
|
+
targetServerName?: string
|
|
162
|
+
targetServerStatus?: ServerStatus
|
|
163
|
+
run: ProjectBackupRun
|
|
164
|
+
isRestoring: boolean
|
|
165
|
+
onClose: () => void
|
|
166
|
+
onRestore: Restore
|
|
167
|
+
}) {
|
|
168
|
+
const [selected, setSelected] = useState(
|
|
169
|
+
() => new Set(contents.map((item) => item.artifact.id)),
|
|
170
|
+
)
|
|
171
|
+
const [pending, setPending] = useState(false)
|
|
172
|
+
const [error, setError] = useState<string | null>(null)
|
|
173
|
+
const busy = pending || isRestoring
|
|
174
|
+
async function submit() {
|
|
175
|
+
if (busy || !selected.size) return
|
|
176
|
+
setError(null)
|
|
177
|
+
setPending(true)
|
|
178
|
+
try {
|
|
179
|
+
const artifacts = contents
|
|
180
|
+
.filter((item) => selected.has(item.artifact.id))
|
|
181
|
+
.map(({ artifact, name, database }) =>
|
|
182
|
+
backupRestoreArtifactSchema.parse(
|
|
183
|
+
artifact.type === 'volume'
|
|
184
|
+
? {
|
|
185
|
+
artifactId: artifact.id,
|
|
186
|
+
type: 'volume',
|
|
187
|
+
targetVolume: name,
|
|
188
|
+
}
|
|
189
|
+
: {
|
|
190
|
+
artifactId: artifact.id,
|
|
191
|
+
type: 'database',
|
|
192
|
+
targetService: database!.service,
|
|
193
|
+
},
|
|
194
|
+
),
|
|
195
|
+
)
|
|
196
|
+
await onRestore({ run, artifacts })
|
|
197
|
+
onClose()
|
|
198
|
+
} catch (cause) {
|
|
199
|
+
setError(
|
|
200
|
+
getPublicErrorMessage(
|
|
201
|
+
cause,
|
|
202
|
+
'Unable to queue restore. Please try again.',
|
|
203
|
+
),
|
|
204
|
+
)
|
|
205
|
+
} finally {
|
|
206
|
+
setPending(false)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return (
|
|
210
|
+
<Dialog
|
|
211
|
+
open
|
|
212
|
+
onOpenChange={(next) => {
|
|
213
|
+
if (!next && !busy) onClose()
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
<DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md">
|
|
217
|
+
<DialogHeader>
|
|
218
|
+
<DialogTitle>Restore backup</DialogTitle>
|
|
219
|
+
<DialogDescription>
|
|
220
|
+
Select the volumes and databases to restore from this backup.
|
|
221
|
+
Selected data will be replaced. The application stops during volume
|
|
222
|
+
restoration.
|
|
223
|
+
</DialogDescription>
|
|
224
|
+
</DialogHeader>
|
|
225
|
+
<BackupRestoreSummary
|
|
226
|
+
policyName={policyName}
|
|
227
|
+
run={run}
|
|
228
|
+
serverName={targetServerName}
|
|
229
|
+
serverStatus={targetServerStatus}
|
|
230
|
+
/>
|
|
231
|
+
<form
|
|
232
|
+
id="backup-restore-form"
|
|
233
|
+
onSubmit={(event) => {
|
|
234
|
+
event.preventDefault()
|
|
235
|
+
void submit()
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
<fieldset disabled={busy} className="space-y-4">
|
|
239
|
+
{(['volume', 'database'] as const).map((type) => {
|
|
240
|
+
const items = contents.filter(
|
|
241
|
+
(item) => item.artifact.type === type,
|
|
242
|
+
)
|
|
243
|
+
return (
|
|
244
|
+
<BackupRestoreSection
|
|
245
|
+
key={type}
|
|
246
|
+
title={type === 'volume' ? 'Volumes' : 'Databases'}
|
|
247
|
+
>
|
|
248
|
+
<ul>
|
|
249
|
+
{items.length ? (
|
|
250
|
+
items.map(({ artifact, name, database }) => {
|
|
251
|
+
const engine = database
|
|
252
|
+
? backupDatabaseEngines.find(
|
|
253
|
+
(item) => item.value === database.engine,
|
|
254
|
+
)?.label
|
|
255
|
+
: undefined
|
|
256
|
+
return (
|
|
257
|
+
<li
|
|
258
|
+
key={artifact.id}
|
|
259
|
+
className="border-b last:border-b-0"
|
|
260
|
+
>
|
|
261
|
+
<label className="flex min-w-0 cursor-pointer items-start gap-2 px-4 py-2 hover:bg-muted/50">
|
|
262
|
+
<Checkbox
|
|
263
|
+
className="mt-0.5"
|
|
264
|
+
checked={selected.has(artifact.id)}
|
|
265
|
+
disabled={busy}
|
|
266
|
+
aria-label={`Restore ${type} ${name}${database ? ` (${database.database || 'all databases'})` : ''}`}
|
|
267
|
+
onCheckedChange={(checked) =>
|
|
268
|
+
setSelected((previous) => {
|
|
269
|
+
const next = new Set(previous)
|
|
270
|
+
if (checked === true) next.add(artifact.id)
|
|
271
|
+
else next.delete(artifact.id)
|
|
272
|
+
return next
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
/>
|
|
276
|
+
<span className="min-w-0 break-words">
|
|
277
|
+
{name}
|
|
278
|
+
<span className="ml-2 text-muted-foreground">
|
|
279
|
+
{formatBytes(artifact.sizeBytes)}
|
|
280
|
+
</span>
|
|
281
|
+
{database ? (
|
|
282
|
+
<span className="ml-2 text-muted-foreground">
|
|
283
|
+
{database.database || 'All databases'} ·{' '}
|
|
284
|
+
{engine}
|
|
285
|
+
</span>
|
|
286
|
+
) : null}
|
|
287
|
+
</span>
|
|
288
|
+
</label>
|
|
289
|
+
</li>
|
|
290
|
+
)
|
|
291
|
+
})
|
|
292
|
+
) : (
|
|
293
|
+
<li className="px-4 py-2 text-muted-foreground">
|
|
294
|
+
{type === 'volume' ? 'No volumes' : 'No databases'}
|
|
295
|
+
</li>
|
|
296
|
+
)}
|
|
297
|
+
</ul>
|
|
298
|
+
</BackupRestoreSection>
|
|
299
|
+
)
|
|
300
|
+
})}
|
|
301
|
+
<FieldError>{error}</FieldError>
|
|
302
|
+
</fieldset>
|
|
303
|
+
</form>
|
|
304
|
+
<DialogFooter>
|
|
305
|
+
<Button
|
|
306
|
+
type="button"
|
|
307
|
+
variant="ghost"
|
|
308
|
+
disabled={busy}
|
|
309
|
+
onClick={onClose}
|
|
310
|
+
>
|
|
311
|
+
Cancel
|
|
312
|
+
</Button>
|
|
313
|
+
<Button
|
|
314
|
+
type="submit"
|
|
315
|
+
form="backup-restore-form"
|
|
316
|
+
disabled={busy || !selected.size}
|
|
317
|
+
>
|
|
318
|
+
{busy ? (
|
|
319
|
+
<LoaderIcon data-icon="inline-start" className="animate-spin" />
|
|
320
|
+
) : null}
|
|
321
|
+
Restore
|
|
322
|
+
</Button>
|
|
323
|
+
</DialogFooter>
|
|
324
|
+
</DialogContent>
|
|
325
|
+
</Dialog>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function BackupRestoreSummary({
|
|
330
|
+
policyName,
|
|
331
|
+
run,
|
|
332
|
+
serverName,
|
|
333
|
+
serverStatus,
|
|
334
|
+
}: {
|
|
335
|
+
policyName?: string
|
|
336
|
+
run: ProjectBackupRun
|
|
337
|
+
serverName?: string
|
|
338
|
+
serverStatus?: ServerStatus
|
|
339
|
+
}) {
|
|
340
|
+
return (
|
|
341
|
+
<BackupRestoreSection title="Backup">
|
|
342
|
+
<dl className="divide-y">
|
|
343
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
344
|
+
<dt className="text-muted-foreground">Created</dt>
|
|
345
|
+
<dd>
|
|
346
|
+
<BackupTimestamp
|
|
347
|
+
value={run.startedAt ?? run.createdAt}
|
|
348
|
+
className="text-foreground"
|
|
349
|
+
/>
|
|
350
|
+
</dd>
|
|
351
|
+
</div>
|
|
352
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
353
|
+
<dt className="text-muted-foreground">Policy</dt>
|
|
354
|
+
<dd
|
|
355
|
+
className={`min-w-0 break-words${policyName ? '' : ' text-muted-foreground'}`}
|
|
356
|
+
>
|
|
357
|
+
{policyName ?? 'Deleted policy'}
|
|
358
|
+
</dd>
|
|
359
|
+
</div>
|
|
360
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
361
|
+
<dt className="text-muted-foreground">Environment</dt>
|
|
362
|
+
<dd className="flex min-w-0 items-center gap-2">
|
|
363
|
+
<EnvironmentDot color={run.environmentColor} />
|
|
364
|
+
{run.environmentName}
|
|
365
|
+
</dd>
|
|
366
|
+
</div>
|
|
367
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
368
|
+
<dt className="text-muted-foreground">Server</dt>
|
|
369
|
+
<dd className="flex min-w-0 items-center gap-2">
|
|
370
|
+
{serverStatus ? (
|
|
371
|
+
<Tooltip>
|
|
372
|
+
<TooltipTrigger asChild>
|
|
373
|
+
<ServerAvatar
|
|
374
|
+
name={serverName ?? run.serverName ?? 'Server'}
|
|
375
|
+
status={serverStatus}
|
|
376
|
+
size="sm"
|
|
377
|
+
/>
|
|
378
|
+
</TooltipTrigger>
|
|
379
|
+
<TooltipContent>
|
|
380
|
+
{serverStatus.charAt(0).toUpperCase() + serverStatus.slice(1)}
|
|
381
|
+
</TooltipContent>
|
|
382
|
+
</Tooltip>
|
|
383
|
+
) : null}
|
|
384
|
+
<span className="min-w-0 break-words">
|
|
385
|
+
{serverName ?? run.serverName ?? 'Unknown server'}
|
|
386
|
+
</span>
|
|
387
|
+
</dd>
|
|
388
|
+
</div>
|
|
389
|
+
</dl>
|
|
390
|
+
</BackupRestoreSection>
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export function BackupRestoreDetails({
|
|
395
|
+
run,
|
|
396
|
+
restore,
|
|
397
|
+
policyName,
|
|
398
|
+
projectId,
|
|
399
|
+
serverStatus,
|
|
400
|
+
onClose,
|
|
401
|
+
}: {
|
|
402
|
+
run?: ProjectBackupRun
|
|
403
|
+
restore: ProjectBackupRestore
|
|
404
|
+
policyName?: string
|
|
405
|
+
projectId: string
|
|
406
|
+
serverStatus?: ServerStatus
|
|
407
|
+
onClose: () => void
|
|
408
|
+
}) {
|
|
409
|
+
return (
|
|
410
|
+
<Dialog
|
|
411
|
+
open
|
|
412
|
+
onOpenChange={(next) => {
|
|
413
|
+
if (!next) onClose()
|
|
414
|
+
}}
|
|
415
|
+
>
|
|
416
|
+
<DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md">
|
|
417
|
+
<DialogHeader>
|
|
418
|
+
<DialogTitle>Restore details</DialogTitle>
|
|
419
|
+
<DialogDescription>
|
|
420
|
+
Restore status, source backup, and data selected for recovery.
|
|
421
|
+
</DialogDescription>
|
|
422
|
+
</DialogHeader>
|
|
423
|
+
<BackupRestoreSection title="Restore">
|
|
424
|
+
<dl className="divide-y">
|
|
425
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
426
|
+
<dt className="text-muted-foreground">Started</dt>
|
|
427
|
+
<dd>
|
|
428
|
+
{restore.startedAt ? (
|
|
429
|
+
<BackupTimestamp
|
|
430
|
+
value={restore.startedAt}
|
|
431
|
+
className="text-foreground"
|
|
432
|
+
/>
|
|
433
|
+
) : (
|
|
434
|
+
<span className="text-muted-foreground">
|
|
435
|
+
{restore.status === 'queued'
|
|
436
|
+
? 'Not started'
|
|
437
|
+
: 'Not recorded'}
|
|
438
|
+
</span>
|
|
439
|
+
)}
|
|
440
|
+
</dd>
|
|
441
|
+
</div>
|
|
442
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
443
|
+
<dt className="text-muted-foreground">Status</dt>
|
|
444
|
+
<dd
|
|
445
|
+
className={`flex items-center gap-2 ${restore.status === 'succeeded' ? 'text-success' : restore.status === 'failed' ? 'text-destructive' : 'text-muted-foreground'}`}
|
|
446
|
+
>
|
|
447
|
+
<BackupStatusIcon status={restore.status} />
|
|
448
|
+
{formatBackupStatus(restore.status)}
|
|
449
|
+
</dd>
|
|
450
|
+
</div>
|
|
451
|
+
{restore.errorMessage ? (
|
|
452
|
+
<div className="grid grid-cols-[6rem_minmax(0,1fr)] gap-x-4 px-4 py-2">
|
|
453
|
+
<dt className="text-muted-foreground">Message</dt>
|
|
454
|
+
<dd className="min-w-0 whitespace-pre-wrap break-words text-foreground">
|
|
455
|
+
{restore.errorMessage}
|
|
456
|
+
</dd>
|
|
457
|
+
</div>
|
|
458
|
+
) : null}
|
|
459
|
+
</dl>
|
|
460
|
+
</BackupRestoreSection>{' '}
|
|
461
|
+
{run ? (
|
|
462
|
+
<BackupRestoreSummary
|
|
463
|
+
policyName={policyName}
|
|
464
|
+
run={run}
|
|
465
|
+
serverName={restore.serverName ?? undefined}
|
|
466
|
+
serverStatus={serverStatus}
|
|
467
|
+
/>
|
|
468
|
+
) : (
|
|
469
|
+
<p className="text-sm text-muted-foreground">
|
|
470
|
+
Source backup no longer available.
|
|
471
|
+
</p>
|
|
472
|
+
)}
|
|
473
|
+
{restore.artifacts ? (
|
|
474
|
+
<div className="space-y-4" aria-label="Restored contents">
|
|
475
|
+
{(['volume', 'database'] as const).map((type) => {
|
|
476
|
+
const items = restore.artifacts!.filter(
|
|
477
|
+
(item) => item.type === type,
|
|
478
|
+
)
|
|
479
|
+
return (
|
|
480
|
+
<BackupRestoreSection
|
|
481
|
+
key={type}
|
|
482
|
+
title={type === 'volume' ? 'Volumes' : 'Databases'}
|
|
483
|
+
>
|
|
484
|
+
{items.length ? (
|
|
485
|
+
<ul className="divide-y">
|
|
486
|
+
{items.map((item) => {
|
|
487
|
+
const artifact = run?.artifacts.find(
|
|
488
|
+
(a) => a.id === item.artifactId,
|
|
489
|
+
)
|
|
490
|
+
const database =
|
|
491
|
+
artifact && type === 'database'
|
|
492
|
+
? databaseArtifactTarget(
|
|
493
|
+
artifact.objectKey,
|
|
494
|
+
run?.databaseTargets ?? [],
|
|
495
|
+
)
|
|
496
|
+
: undefined
|
|
497
|
+
const name =
|
|
498
|
+
type === 'volume'
|
|
499
|
+
? item.targetVolume
|
|
500
|
+
? getComposeVolumeName(
|
|
501
|
+
item.targetVolume,
|
|
502
|
+
projectId,
|
|
503
|
+
restore.environmentId,
|
|
504
|
+
)
|
|
505
|
+
: undefined
|
|
506
|
+
: item.targetService
|
|
507
|
+
return (
|
|
508
|
+
<li
|
|
509
|
+
key={item.artifactId}
|
|
510
|
+
className="min-w-0 break-words px-4 py-2"
|
|
511
|
+
>
|
|
512
|
+
{name ??
|
|
513
|
+
(artifact && run
|
|
514
|
+
? getComposeArtifactName(
|
|
515
|
+
artifact,
|
|
516
|
+
projectId,
|
|
517
|
+
run.environmentId,
|
|
518
|
+
)
|
|
519
|
+
: 'Unknown target')}
|
|
520
|
+
{artifact ? (
|
|
521
|
+
<span className="ml-2 text-muted-foreground">
|
|
522
|
+
{formatBytes(artifact.sizeBytes)}
|
|
523
|
+
</span>
|
|
524
|
+
) : null}
|
|
525
|
+
{database ? (
|
|
526
|
+
<span className="ml-2 text-muted-foreground">
|
|
527
|
+
{database.database || 'All databases'}
|
|
528
|
+
</span>
|
|
529
|
+
) : null}
|
|
530
|
+
</li>
|
|
531
|
+
)
|
|
532
|
+
})}
|
|
533
|
+
</ul>
|
|
534
|
+
) : (
|
|
535
|
+
<p className="px-4 py-2 text-muted-foreground">
|
|
536
|
+
{type === 'volume' ? 'No volumes' : 'No databases'}
|
|
537
|
+
</p>
|
|
538
|
+
)}
|
|
539
|
+
</BackupRestoreSection>
|
|
540
|
+
)
|
|
541
|
+
})}
|
|
542
|
+
</div>
|
|
543
|
+
) : (
|
|
544
|
+
<p className="text-sm text-muted-foreground">
|
|
545
|
+
Recorded contents are unavailable.
|
|
546
|
+
</p>
|
|
547
|
+
)}
|
|
548
|
+
<DialogFooter>
|
|
549
|
+
<Button variant="ghost" onClick={onClose}>
|
|
550
|
+
Close
|
|
551
|
+
</Button>
|
|
552
|
+
</DialogFooter>
|
|
553
|
+
</DialogContent>
|
|
554
|
+
</Dialog>
|
|
555
|
+
)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function BackupRestoreSection({
|
|
559
|
+
title,
|
|
560
|
+
children,
|
|
561
|
+
}: {
|
|
562
|
+
title: string
|
|
563
|
+
children: ReactNode
|
|
564
|
+
}) {
|
|
565
|
+
return (
|
|
566
|
+
<section className="space-y-2" aria-label={title}>
|
|
567
|
+
<h3 className="text-sm font-medium">{title}</h3>
|
|
568
|
+
<div className="overflow-hidden rounded-xl border bg-card text-card-foreground text-sm">
|
|
569
|
+
{children}
|
|
570
|
+
</div>
|
|
571
|
+
</section>
|
|
572
|
+
)
|
|
573
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BanIcon,
|
|
3
|
+
CircleCheckIcon,
|
|
4
|
+
CircleXIcon,
|
|
5
|
+
CircleAlertIcon,
|
|
6
|
+
ClockIcon,
|
|
7
|
+
LoaderIcon,
|
|
8
|
+
} from 'lucide-react'
|
|
9
|
+
import type { ProjectBackupRun } from '#devpush/server/projects/types'
|
|
10
|
+
|
|
11
|
+
export function BackupStatusIcon({
|
|
12
|
+
status,
|
|
13
|
+
}: {
|
|
14
|
+
status: ProjectBackupRun['status'] | null
|
|
15
|
+
}) {
|
|
16
|
+
if (status === 'succeeded') {
|
|
17
|
+
return <CircleCheckIcon className="size-4 shrink-0 text-success" />
|
|
18
|
+
}
|
|
19
|
+
if (status === 'queued')
|
|
20
|
+
return <ClockIcon className="size-4 shrink-0 text-muted-foreground" />
|
|
21
|
+
if (status === 'failed') {
|
|
22
|
+
return <CircleAlertIcon className="size-4 shrink-0 text-destructive" />
|
|
23
|
+
}
|
|
24
|
+
if (status === 'running') {
|
|
25
|
+
return (
|
|
26
|
+
<LoaderIcon className="size-4 shrink-0 animate-spin text-muted-foreground" />
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
if (status === 'canceled') {
|
|
30
|
+
return <CircleXIcon className="size-4 shrink-0 text-muted-foreground" />
|
|
31
|
+
}
|
|
32
|
+
return <BanIcon className="size-4 shrink-0 text-muted-foreground" />
|
|
33
|
+
}
|