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,876 @@
|
|
|
1
|
+
import { mutationErrorOptions, navigateFilters } from '#devpush/lib/action-feedback'
|
|
2
|
+
import { backupConfigSchema } from '#devpush/lib/backup-policy-schema'
|
|
3
|
+
import { showSettingsConflict } from '#devpush/lib/settings-conflict'
|
|
4
|
+
import {
|
|
5
|
+
DropdownMenu,
|
|
6
|
+
DropdownMenuTrigger,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem,
|
|
9
|
+
} from '#devpush/components/ui/dropdown-menu'
|
|
10
|
+
import { BackupJobLogs } from './backup-job-logs'
|
|
11
|
+
import { canManageTeamSettings } from '#devpush/lib/team-role'
|
|
12
|
+
import { Link, useParams, useRouter } from '@tanstack/react-router'
|
|
13
|
+
import { useQueryClient } from '@tanstack/react-query'
|
|
14
|
+
import {
|
|
15
|
+
ArrowDownIcon,
|
|
16
|
+
Undo2Icon,
|
|
17
|
+
EllipsisVerticalIcon,
|
|
18
|
+
ClockIcon,
|
|
19
|
+
PlusIcon,
|
|
20
|
+
TriangleAlertIcon,
|
|
21
|
+
} from 'lucide-react'
|
|
22
|
+
import { useEffect, useState } from 'react'
|
|
23
|
+
import { toast } from 'sonner'
|
|
24
|
+
|
|
25
|
+
import { Alert, AlertDescription } from '#devpush/components/ui/alert'
|
|
26
|
+
import { Badge } from '#devpush/components/ui/badge'
|
|
27
|
+
import { Button } from '#devpush/components/ui/button'
|
|
28
|
+
import { ButtonGroup } from '#devpush/components/ui/button-group'
|
|
29
|
+
import { Switch } from '#devpush/components/ui/switch'
|
|
30
|
+
import {
|
|
31
|
+
AlertDialog,
|
|
32
|
+
AlertDialogContent,
|
|
33
|
+
AlertDialogHeader,
|
|
34
|
+
AlertDialogTitle,
|
|
35
|
+
AlertDialogDescription,
|
|
36
|
+
AlertDialogFooter,
|
|
37
|
+
AlertDialogCancel,
|
|
38
|
+
AlertDialogAction,
|
|
39
|
+
} from '#devpush/components/ui/alert-dialog'
|
|
40
|
+
import {
|
|
41
|
+
Tooltip,
|
|
42
|
+
TooltipContent,
|
|
43
|
+
TooltipTrigger,
|
|
44
|
+
} from '#devpush/components/ui/tooltip'
|
|
45
|
+
|
|
46
|
+
import {
|
|
47
|
+
Empty,
|
|
48
|
+
EmptyContent,
|
|
49
|
+
EmptyDescription,
|
|
50
|
+
EmptyHeader,
|
|
51
|
+
EmptyTitle,
|
|
52
|
+
} from '#devpush/components/ui/empty'
|
|
53
|
+
import { ProjectHeading } from './project-heading'
|
|
54
|
+
import {
|
|
55
|
+
Select,
|
|
56
|
+
SelectContent,
|
|
57
|
+
SelectItem,
|
|
58
|
+
SelectTrigger,
|
|
59
|
+
SelectValue,
|
|
60
|
+
} from '#devpush/components/ui/select'
|
|
61
|
+
import { BackupStatusIcon } from './backup-status-icon'
|
|
62
|
+
import { BackupTimestamp } from './backup-timestamp'
|
|
63
|
+
import { ServerAvatar } from '#devpush/features/servers/server-avatar'
|
|
64
|
+
import { EnvironmentDot } from '#devpush/features/projects/environment-dot'
|
|
65
|
+
import { getPublicErrorMessage } from '#devpush/lib/public-error'
|
|
66
|
+
import { setProjectContextQueryData } from '#devpush/lib/project-context-query'
|
|
67
|
+
import {
|
|
68
|
+
runProjectBackup,
|
|
69
|
+
restoreProjectBackup,
|
|
70
|
+
saveProjectBackupPolicyAction,
|
|
71
|
+
deleteProjectBackupPolicyAction,
|
|
72
|
+
} from '#devpush/server/projects/functions'
|
|
73
|
+
import type {
|
|
74
|
+
ProjectBackupConfig,
|
|
75
|
+
ProjectBackupRun,
|
|
76
|
+
ProjectBackupRestore,
|
|
77
|
+
ProjectContext,
|
|
78
|
+
} from '#devpush/server/projects/types'
|
|
79
|
+
|
|
80
|
+
import {
|
|
81
|
+
getBackupActivity,
|
|
82
|
+
getLatestBackupRuns,
|
|
83
|
+
formatBackupSchedule as formatSchedule,
|
|
84
|
+
formatBackupStatus as formatStatus,
|
|
85
|
+
} from './project-backup-utils'
|
|
86
|
+
import type { BackupFilters } from './project-backup-utils'
|
|
87
|
+
import {
|
|
88
|
+
BackupRestoreDetails,
|
|
89
|
+
BackupRunRestoreActions,
|
|
90
|
+
} from './backup-restore-actions'
|
|
91
|
+
import type { BackupRestoreSelection } from './backup-restore-actions'
|
|
92
|
+
import { BackupPolicyDialog } from './project-backup-policy'
|
|
93
|
+
|
|
94
|
+
export function ProjectBackups({
|
|
95
|
+
context,
|
|
96
|
+
filters,
|
|
97
|
+
}: {
|
|
98
|
+
context: ProjectContext
|
|
99
|
+
filters: BackupFilters
|
|
100
|
+
}) {
|
|
101
|
+
const params = useParams({ strict: false })
|
|
102
|
+
const router = useRouter()
|
|
103
|
+
const queryClient = useQueryClient()
|
|
104
|
+
const canManage = canManageTeamSettings(context.team.role)
|
|
105
|
+
const [backupConfigs, setBackupConfigs] = useState(context.backupConfigs)
|
|
106
|
+
const [backupRuns, setBackupRuns] = useState(context.backupRuns)
|
|
107
|
+
const [savingPolicyId, setSavingPolicyId] = useState<string | null>(null)
|
|
108
|
+
const [runConfirmation, setRunConfirmation] =
|
|
109
|
+
useState<ProjectBackupConfig | null>(null)
|
|
110
|
+
const [logOperation, setLogOperation] = useState<{
|
|
111
|
+
type: 'backup' | 'restore'
|
|
112
|
+
id: string
|
|
113
|
+
errorMessage: string | null
|
|
114
|
+
} | null>(null)
|
|
115
|
+
const [detailsRestore, setDetailsRestore] =
|
|
116
|
+
useState<ProjectBackupRestore | null>(null)
|
|
117
|
+
const [runningBackupId, setRunningBackupId] = useState<string | null>(null)
|
|
118
|
+
const [restoringRunId, setRestoringRunId] = useState<string | null>(null)
|
|
119
|
+
const actionBusy =
|
|
120
|
+
savingPolicyId !== null ||
|
|
121
|
+
runningBackupId !== null ||
|
|
122
|
+
restoringRunId !== null
|
|
123
|
+
const latestBackupRuns = getLatestBackupRuns(backupRuns)
|
|
124
|
+
const runs = getBackupActivity(backupRuns, context.backupRestores, filters)
|
|
125
|
+
const teamSlug =
|
|
126
|
+
typeof params.teamSlug === 'string' ? params.teamSlug : context.team.slug
|
|
127
|
+
const projectName =
|
|
128
|
+
typeof params.projectName === 'string'
|
|
129
|
+
? params.projectName
|
|
130
|
+
: context.project.name
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
setBackupConfigs(context.backupConfigs)
|
|
134
|
+
}, [context.backupConfigs])
|
|
135
|
+
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setBackupRuns(context.backupRuns)
|
|
138
|
+
}, [context.backupRuns])
|
|
139
|
+
|
|
140
|
+
function setFilter(key: keyof BackupFilters, value: string) {
|
|
141
|
+
void navigateFilters(() =>
|
|
142
|
+
router.navigate({
|
|
143
|
+
to: '/$teamSlug/projects/$projectName/backups',
|
|
144
|
+
params: {
|
|
145
|
+
teamSlug,
|
|
146
|
+
projectName,
|
|
147
|
+
},
|
|
148
|
+
search: (current) => ({
|
|
149
|
+
...current,
|
|
150
|
+
[key]: value === 'all' ? undefined : value,
|
|
151
|
+
}),
|
|
152
|
+
}),
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function resetFilters() {
|
|
157
|
+
void navigateFilters(() =>
|
|
158
|
+
router.navigate({
|
|
159
|
+
to: '/$teamSlug/projects/$projectName/backups',
|
|
160
|
+
params: { teamSlug, projectName },
|
|
161
|
+
search: {},
|
|
162
|
+
}),
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function updateBackupConfigs(
|
|
167
|
+
nextConfigs: Array<ProjectBackupConfig>,
|
|
168
|
+
message: string,
|
|
169
|
+
policyId?: string,
|
|
170
|
+
) {
|
|
171
|
+
if (policyId) {
|
|
172
|
+
setSavingPolicyId(policyId)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
try {
|
|
176
|
+
const policy = nextConfigs.find((item) => item.id === policyId)
|
|
177
|
+
const original = backupConfigs.find((item) => item.id === policyId)!
|
|
178
|
+
const nextContext = policy
|
|
179
|
+
? await saveProjectBackupPolicyAction({
|
|
180
|
+
data: {
|
|
181
|
+
projectId: context.project.id,
|
|
182
|
+
teamSlug,
|
|
183
|
+
projectName,
|
|
184
|
+
settingsVersion: original.settingsVersion,
|
|
185
|
+
policy: backupConfigSchema.parse(policy),
|
|
186
|
+
},
|
|
187
|
+
})
|
|
188
|
+
: await deleteProjectBackupPolicyAction({
|
|
189
|
+
data: {
|
|
190
|
+
projectId: context.project.id,
|
|
191
|
+
teamSlug,
|
|
192
|
+
projectName,
|
|
193
|
+
settingsVersion: original.settingsVersion,
|
|
194
|
+
policyId: original.id,
|
|
195
|
+
},
|
|
196
|
+
})
|
|
197
|
+
await setProjectContextQueryData(queryClient, nextContext, 'backups')
|
|
198
|
+
setBackupConfigs(nextContext.backupConfigs)
|
|
199
|
+
setBackupRuns(nextContext.backupRuns)
|
|
200
|
+
toast.success(message)
|
|
201
|
+
} finally {
|
|
202
|
+
if (policyId) {
|
|
203
|
+
setSavingPolicyId(null)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async function setPolicyEnabled(
|
|
209
|
+
backup: ProjectBackupConfig,
|
|
210
|
+
enabled: boolean,
|
|
211
|
+
) {
|
|
212
|
+
if (actionBusy) return
|
|
213
|
+
const nextConfigs = backupConfigs.map((item) =>
|
|
214
|
+
item.id === backup.id ? { ...item, enabled } : item,
|
|
215
|
+
)
|
|
216
|
+
try {
|
|
217
|
+
await updateBackupConfigs(
|
|
218
|
+
nextConfigs,
|
|
219
|
+
`${backup.name} ${enabled ? 'enabled' : 'disabled'}.`,
|
|
220
|
+
backup.id,
|
|
221
|
+
)
|
|
222
|
+
} catch (cause) {
|
|
223
|
+
if (showSettingsConflict(cause)) return
|
|
224
|
+
toast.error(
|
|
225
|
+
getPublicErrorMessage(
|
|
226
|
+
cause,
|
|
227
|
+
'Unable to save backup policy. Please try again.',
|
|
228
|
+
),
|
|
229
|
+
...mutationErrorOptions(cause),
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
async function runBackup(backup: ProjectBackupConfig) {
|
|
235
|
+
if (actionBusy) return
|
|
236
|
+
setRunningBackupId(backup.id)
|
|
237
|
+
|
|
238
|
+
try {
|
|
239
|
+
const nextContext = await runProjectBackup({
|
|
240
|
+
data: {
|
|
241
|
+
teamSlug,
|
|
242
|
+
projectName,
|
|
243
|
+
backupConfigId: backup.id,
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
await setProjectContextQueryData(queryClient, nextContext, 'backups')
|
|
247
|
+
setBackupConfigs(nextContext.backupConfigs)
|
|
248
|
+
setBackupRuns(nextContext.backupRuns)
|
|
249
|
+
toast.success('Backup queued.')
|
|
250
|
+
setRunConfirmation(null)
|
|
251
|
+
} catch (error) {
|
|
252
|
+
if (showSettingsConflict(error)) return
|
|
253
|
+
toast.error(
|
|
254
|
+
getPublicErrorMessage(error, 'Unable to queue backup.'),
|
|
255
|
+
...mutationErrorOptions(error),
|
|
256
|
+
)
|
|
257
|
+
} finally {
|
|
258
|
+
setRunningBackupId(null)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
async function restoreBackup({
|
|
263
|
+
run,
|
|
264
|
+
artifacts,
|
|
265
|
+
}: {
|
|
266
|
+
run: ProjectBackupRun
|
|
267
|
+
artifacts: BackupRestoreSelection[]
|
|
268
|
+
}) {
|
|
269
|
+
setRestoringRunId(run.id)
|
|
270
|
+
try {
|
|
271
|
+
const nextContext = await restoreProjectBackup({
|
|
272
|
+
data: {
|
|
273
|
+
teamSlug,
|
|
274
|
+
projectName,
|
|
275
|
+
backupRunId: run.id,
|
|
276
|
+
artifacts,
|
|
277
|
+
},
|
|
278
|
+
})
|
|
279
|
+
await setProjectContextQueryData(queryClient, nextContext, 'backups')
|
|
280
|
+
setBackupConfigs(nextContext.backupConfigs)
|
|
281
|
+
setBackupRuns(nextContext.backupRuns)
|
|
282
|
+
toast.success('Restore queued.')
|
|
283
|
+
} finally {
|
|
284
|
+
setRestoringRunId(null)
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return (
|
|
289
|
+
<>
|
|
290
|
+
{detailsRestore ? (
|
|
291
|
+
<BackupRestoreDetails
|
|
292
|
+
projectId={context.project.id}
|
|
293
|
+
restore={
|
|
294
|
+
context.backupRestores.find(
|
|
295
|
+
(item) => item.id === detailsRestore.id,
|
|
296
|
+
) ?? detailsRestore
|
|
297
|
+
}
|
|
298
|
+
run={backupRuns.find((run) => run.id === detailsRestore.backupRunId)}
|
|
299
|
+
policyName={
|
|
300
|
+
backupConfigs.find(
|
|
301
|
+
(config) =>
|
|
302
|
+
config.id ===
|
|
303
|
+
backupRuns.find((run) => run.id === detailsRestore.backupRunId)
|
|
304
|
+
?.configId,
|
|
305
|
+
)?.name
|
|
306
|
+
}
|
|
307
|
+
serverStatus={
|
|
308
|
+
context.servers.find(
|
|
309
|
+
(server) => server.id === detailsRestore.serverId,
|
|
310
|
+
)?.status
|
|
311
|
+
}
|
|
312
|
+
onClose={() => setDetailsRestore(null)}
|
|
313
|
+
/>
|
|
314
|
+
) : null}
|
|
315
|
+
<ProjectHeading
|
|
316
|
+
teamSlug={teamSlug}
|
|
317
|
+
project={context.project}
|
|
318
|
+
crumbs={[<span className="truncate">Backups</span>]}
|
|
319
|
+
/>
|
|
320
|
+
<AlertDialog
|
|
321
|
+
open={runConfirmation !== null}
|
|
322
|
+
onOpenChange={(open) => {
|
|
323
|
+
if (!open && !runningBackupId) {
|
|
324
|
+
setRunConfirmation(null)
|
|
325
|
+
}
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
<AlertDialogContent>
|
|
329
|
+
<AlertDialogHeader>
|
|
330
|
+
<AlertDialogTitle>Run {runConfirmation?.name}?</AlertDialogTitle>
|
|
331
|
+
<AlertDialogDescription>
|
|
332
|
+
Queue a backup now for{' '}
|
|
333
|
+
{context.environments.find(
|
|
334
|
+
(environment) =>
|
|
335
|
+
environment.id === runConfirmation?.environmentId,
|
|
336
|
+
)?.name ?? 'this environment'}{' '}
|
|
337
|
+
using this policy’s saved configuration.
|
|
338
|
+
</AlertDialogDescription>
|
|
339
|
+
</AlertDialogHeader>
|
|
340
|
+
<AlertDialogFooter>
|
|
341
|
+
<AlertDialogCancel disabled={runningBackupId !== null}>
|
|
342
|
+
Cancel
|
|
343
|
+
</AlertDialogCancel>
|
|
344
|
+
<AlertDialogAction
|
|
345
|
+
disabled={runningBackupId !== null}
|
|
346
|
+
onClick={(event) => {
|
|
347
|
+
event.preventDefault()
|
|
348
|
+
if (runConfirmation) void runBackup(runConfirmation)
|
|
349
|
+
}}
|
|
350
|
+
>
|
|
351
|
+
{runningBackupId ? 'Queuing…' : 'Run backup'}
|
|
352
|
+
</AlertDialogAction>
|
|
353
|
+
</AlertDialogFooter>
|
|
354
|
+
</AlertDialogContent>
|
|
355
|
+
</AlertDialog>
|
|
356
|
+
|
|
357
|
+
{backupConfigs.length === 0 ? (
|
|
358
|
+
<Empty className="min-h-60 border bg-card text-card-foreground">
|
|
359
|
+
<EmptyHeader>
|
|
360
|
+
<EmptyTitle>No backup policies yet.</EmptyTitle>
|
|
361
|
+
<EmptyDescription>
|
|
362
|
+
Create a backup policy for a specific environment.
|
|
363
|
+
</EmptyDescription>
|
|
364
|
+
</EmptyHeader>
|
|
365
|
+
{canManage ? (
|
|
366
|
+
<EmptyContent>
|
|
367
|
+
<BackupPolicyDialog
|
|
368
|
+
context={context}
|
|
369
|
+
teamSlug={teamSlug}
|
|
370
|
+
projectName={projectName}
|
|
371
|
+
backupConfigs={backupConfigs}
|
|
372
|
+
onSaved={setBackupConfigs}
|
|
373
|
+
>
|
|
374
|
+
<Button
|
|
375
|
+
disabled={context.environments.length === 0 || actionBusy}
|
|
376
|
+
>
|
|
377
|
+
<PlusIcon data-icon="inline-start" />
|
|
378
|
+
Create policy
|
|
379
|
+
</Button>
|
|
380
|
+
</BackupPolicyDialog>
|
|
381
|
+
</EmptyContent>
|
|
382
|
+
) : null}
|
|
383
|
+
</Empty>
|
|
384
|
+
) : (
|
|
385
|
+
<>
|
|
386
|
+
<section className="space-y-4">
|
|
387
|
+
<header className="flex h-8 items-center justify-between gap-x-4">
|
|
388
|
+
<h2 className="text-base font-medium">Policies</h2>
|
|
389
|
+
{canManage ? (
|
|
390
|
+
<BackupPolicyDialog
|
|
391
|
+
context={context}
|
|
392
|
+
teamSlug={teamSlug}
|
|
393
|
+
projectName={projectName}
|
|
394
|
+
backupConfigs={backupConfigs}
|
|
395
|
+
onSaved={setBackupConfigs}
|
|
396
|
+
>
|
|
397
|
+
<Button>
|
|
398
|
+
<PlusIcon data-icon="inline-start" />
|
|
399
|
+
Create policy
|
|
400
|
+
</Button>
|
|
401
|
+
</BackupPolicyDialog>
|
|
402
|
+
) : null}
|
|
403
|
+
</header>
|
|
404
|
+
<ul className="scrollbar overflow-x-auto rounded-xl border bg-card text-card-foreground">
|
|
405
|
+
{backupConfigs.map((backup) => {
|
|
406
|
+
const environment = context.environments.find(
|
|
407
|
+
(item) => item.id === backup.environmentId,
|
|
408
|
+
)
|
|
409
|
+
const latestRun = latestBackupRuns.get(backup.id) ?? null
|
|
410
|
+
|
|
411
|
+
return (
|
|
412
|
+
<li
|
|
413
|
+
key={backup.id}
|
|
414
|
+
className="border-b text-sm last:border-b-0"
|
|
415
|
+
>
|
|
416
|
+
<div className="flex h-11 min-w-[30rem] items-center gap-4 px-4 whitespace-nowrap hover:bg-muted/50">
|
|
417
|
+
<Switch
|
|
418
|
+
id={`policy-enabled-${backup.id}`}
|
|
419
|
+
aria-label={`Enable ${backup.name}`}
|
|
420
|
+
checked={backup.enabled}
|
|
421
|
+
disabled={!canManage || actionBusy}
|
|
422
|
+
onCheckedChange={(value) =>
|
|
423
|
+
void setPolicyEnabled(backup, value)
|
|
424
|
+
}
|
|
425
|
+
/>
|
|
426
|
+
<Link
|
|
427
|
+
to="/$teamSlug/projects/$projectName/backups/$backupId"
|
|
428
|
+
params={{ teamSlug, projectName, backupId: backup.id }}
|
|
429
|
+
className={`min-w-0 max-w-80 truncate font-medium ${backup.enabled ? '' : 'text-muted-foreground'}`}
|
|
430
|
+
>
|
|
431
|
+
{backup.name}
|
|
432
|
+
</Link>
|
|
433
|
+
{environment ? (
|
|
434
|
+
<span className="flex shrink-0 items-center gap-2 whitespace-nowrap text-muted-foreground">
|
|
435
|
+
<EnvironmentDot color={environment.color} />
|
|
436
|
+
<span>{environment.name}</span>
|
|
437
|
+
</span>
|
|
438
|
+
) : (
|
|
439
|
+
<span className="shrink-0 whitespace-nowrap text-muted-foreground">
|
|
440
|
+
Unknown environment
|
|
441
|
+
</span>
|
|
442
|
+
)}
|
|
443
|
+
<span className="hidden shrink-0 items-center gap-2 whitespace-nowrap text-muted-foreground sm:flex [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:opacity-50">
|
|
444
|
+
<ClockIcon />
|
|
445
|
+
<span>{formatSchedule(backup.schedule)}</span>
|
|
446
|
+
</span>
|
|
447
|
+
<div className="ml-auto shrink-0">
|
|
448
|
+
<ButtonGroup
|
|
449
|
+
className="-mr-2"
|
|
450
|
+
aria-label="Backup policy actions"
|
|
451
|
+
>
|
|
452
|
+
{canManage ? (
|
|
453
|
+
<Button
|
|
454
|
+
variant="outline"
|
|
455
|
+
size="sm"
|
|
456
|
+
disabled={actionBusy}
|
|
457
|
+
onClick={() => {
|
|
458
|
+
setRunConfirmation(backup)
|
|
459
|
+
}}
|
|
460
|
+
>
|
|
461
|
+
Run
|
|
462
|
+
</Button>
|
|
463
|
+
) : null}
|
|
464
|
+
<DropdownMenu>
|
|
465
|
+
<DropdownMenuTrigger asChild>
|
|
466
|
+
<Button
|
|
467
|
+
variant="outline"
|
|
468
|
+
size="icon-sm"
|
|
469
|
+
aria-label={`Actions for ${backup.name}`}
|
|
470
|
+
>
|
|
471
|
+
<EllipsisVerticalIcon />
|
|
472
|
+
</Button>
|
|
473
|
+
</DropdownMenuTrigger>
|
|
474
|
+
<DropdownMenuContent align="end">
|
|
475
|
+
<DropdownMenuItem asChild>
|
|
476
|
+
<Link
|
|
477
|
+
to="/$teamSlug/projects/$projectName/backups"
|
|
478
|
+
params={{ teamSlug, projectName }}
|
|
479
|
+
search={{ policy: backup.id }}
|
|
480
|
+
hash="activity"
|
|
481
|
+
>
|
|
482
|
+
View activity
|
|
483
|
+
</Link>
|
|
484
|
+
</DropdownMenuItem>
|
|
485
|
+
{canManage ? (
|
|
486
|
+
<DropdownMenuItem asChild>
|
|
487
|
+
<Link
|
|
488
|
+
to="/$teamSlug/projects/$projectName/backups/$backupId"
|
|
489
|
+
params={{
|
|
490
|
+
teamSlug,
|
|
491
|
+
projectName,
|
|
492
|
+
backupId: backup.id,
|
|
493
|
+
}}
|
|
494
|
+
>
|
|
495
|
+
Settings
|
|
496
|
+
</Link>
|
|
497
|
+
</DropdownMenuItem>
|
|
498
|
+
) : null}
|
|
499
|
+
</DropdownMenuContent>
|
|
500
|
+
</DropdownMenu>
|
|
501
|
+
</ButtonGroup>
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
{latestRun?.status === 'failed' ? (
|
|
505
|
+
<Alert variant="destructive" className="mx-4 mb-3 w-auto">
|
|
506
|
+
<TriangleAlertIcon />
|
|
507
|
+
<AlertDescription>
|
|
508
|
+
{latestRun.localRecoveryAvailable
|
|
509
|
+
? 'Remote upload failed; local backup available. Check the storage connection and run this policy again.'
|
|
510
|
+
: (latestRun.errorMessage ??
|
|
511
|
+
'The latest backup failed. Run this policy again after resolving the error.')}
|
|
512
|
+
</AlertDescription>
|
|
513
|
+
</Alert>
|
|
514
|
+
) : null}
|
|
515
|
+
</li>
|
|
516
|
+
)
|
|
517
|
+
})}
|
|
518
|
+
</ul>
|
|
519
|
+
</section>
|
|
520
|
+
</>
|
|
521
|
+
)}
|
|
522
|
+
<section id="activity" className="space-y-4 scroll-mt-28">
|
|
523
|
+
<header className="flex h-8 items-center justify-between gap-x-4">
|
|
524
|
+
<h2 className="text-base font-medium">Activity</h2>
|
|
525
|
+
</header>
|
|
526
|
+
|
|
527
|
+
{backupRuns.length > 0 || context.backupRestores.length > 0 ? (
|
|
528
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
529
|
+
<Select
|
|
530
|
+
value={filters.policy ?? 'all'}
|
|
531
|
+
onValueChange={(value) => setFilter('policy', value)}
|
|
532
|
+
>
|
|
533
|
+
<SelectTrigger>
|
|
534
|
+
<SelectValue placeholder="All policies" />
|
|
535
|
+
</SelectTrigger>
|
|
536
|
+
<SelectContent>
|
|
537
|
+
<SelectItem value="all">All policies</SelectItem>
|
|
538
|
+
{backupConfigs.map((policy) => (
|
|
539
|
+
<SelectItem key={policy.id} value={policy.id}>
|
|
540
|
+
{policy.name}
|
|
541
|
+
</SelectItem>
|
|
542
|
+
))}
|
|
543
|
+
{filters.policy &&
|
|
544
|
+
!backupConfigs.some(
|
|
545
|
+
(policy) => policy.id === filters.policy,
|
|
546
|
+
) ? (
|
|
547
|
+
<SelectItem value={filters.policy}>Deleted policy</SelectItem>
|
|
548
|
+
) : null}
|
|
549
|
+
</SelectContent>
|
|
550
|
+
</Select>
|
|
551
|
+
<Select
|
|
552
|
+
value={filters.type ?? 'all'}
|
|
553
|
+
onValueChange={(value) => setFilter('type', value)}
|
|
554
|
+
>
|
|
555
|
+
<SelectTrigger>
|
|
556
|
+
<SelectValue placeholder="All types" />
|
|
557
|
+
</SelectTrigger>
|
|
558
|
+
<SelectContent>
|
|
559
|
+
<SelectItem value="all">All types</SelectItem>
|
|
560
|
+
<SelectItem value="backup">
|
|
561
|
+
<ArrowDownIcon />
|
|
562
|
+
Backup
|
|
563
|
+
</SelectItem>
|
|
564
|
+
<SelectItem value="restore">
|
|
565
|
+
<Undo2Icon />
|
|
566
|
+
Restore
|
|
567
|
+
</SelectItem>
|
|
568
|
+
</SelectContent>
|
|
569
|
+
</Select>
|
|
570
|
+
<Select
|
|
571
|
+
value={filters.environment ?? 'all'}
|
|
572
|
+
onValueChange={(value) => setFilter('environment', value)}
|
|
573
|
+
>
|
|
574
|
+
<SelectTrigger>
|
|
575
|
+
<SelectValue placeholder="All environments" />
|
|
576
|
+
</SelectTrigger>
|
|
577
|
+
<SelectContent>
|
|
578
|
+
<SelectItem value="all">All environments</SelectItem>
|
|
579
|
+
{context.environments.map((environment) => (
|
|
580
|
+
<SelectItem key={environment.id} value={environment.id}>
|
|
581
|
+
<EnvironmentDot color={environment.color} />
|
|
582
|
+
{environment.name}
|
|
583
|
+
</SelectItem>
|
|
584
|
+
))}
|
|
585
|
+
</SelectContent>
|
|
586
|
+
</Select>
|
|
587
|
+
<Select
|
|
588
|
+
value={filters.status ?? 'all'}
|
|
589
|
+
onValueChange={(value) => setFilter('status', value)}
|
|
590
|
+
>
|
|
591
|
+
<SelectTrigger>
|
|
592
|
+
<SelectValue placeholder="All statuses" />
|
|
593
|
+
</SelectTrigger>
|
|
594
|
+
<SelectContent>
|
|
595
|
+
<SelectItem value="all">All statuses</SelectItem>
|
|
596
|
+
<SelectItem value="queued">
|
|
597
|
+
<BackupStatusIcon status="queued" />
|
|
598
|
+
Queued
|
|
599
|
+
</SelectItem>
|
|
600
|
+
<SelectItem value="running">
|
|
601
|
+
<BackupStatusIcon status="running" />
|
|
602
|
+
Running
|
|
603
|
+
</SelectItem>
|
|
604
|
+
<SelectItem value="succeeded">
|
|
605
|
+
<BackupStatusIcon status="succeeded" />
|
|
606
|
+
Succeeded
|
|
607
|
+
</SelectItem>
|
|
608
|
+
<SelectItem value="failed">
|
|
609
|
+
<BackupStatusIcon status="failed" />
|
|
610
|
+
Failed
|
|
611
|
+
</SelectItem>
|
|
612
|
+
</SelectContent>
|
|
613
|
+
</Select>
|
|
614
|
+
<Select
|
|
615
|
+
value={filters.server ?? 'all'}
|
|
616
|
+
onValueChange={(value) => setFilter('server', value)}
|
|
617
|
+
>
|
|
618
|
+
<SelectTrigger>
|
|
619
|
+
<SelectValue placeholder="All servers" />
|
|
620
|
+
</SelectTrigger>
|
|
621
|
+
<SelectContent>
|
|
622
|
+
<SelectItem value="all">All servers</SelectItem>
|
|
623
|
+
{context.servers.map((server) => (
|
|
624
|
+
<SelectItem key={server.id} value={server.id}>
|
|
625
|
+
<ServerAvatar
|
|
626
|
+
name={server.name}
|
|
627
|
+
status={server.status}
|
|
628
|
+
size="sm"
|
|
629
|
+
/>
|
|
630
|
+
{server.name}
|
|
631
|
+
</SelectItem>
|
|
632
|
+
))}
|
|
633
|
+
</SelectContent>
|
|
634
|
+
</Select>
|
|
635
|
+
<Select
|
|
636
|
+
value={filters.time ?? 'all'}
|
|
637
|
+
onValueChange={(value) => setFilter('time', value)}
|
|
638
|
+
>
|
|
639
|
+
<SelectTrigger>
|
|
640
|
+
<SelectValue placeholder="All dates" />
|
|
641
|
+
</SelectTrigger>
|
|
642
|
+
<SelectContent>
|
|
643
|
+
<SelectItem value="all">All dates</SelectItem>
|
|
644
|
+
<SelectItem value="24h">Last 24 hours</SelectItem>
|
|
645
|
+
<SelectItem value="7d">Last 7 days</SelectItem>
|
|
646
|
+
<SelectItem value="30d">Last 30 days</SelectItem>
|
|
647
|
+
</SelectContent>
|
|
648
|
+
</Select>
|
|
649
|
+
{Object.values(filters).some(
|
|
650
|
+
(value) => value && value !== 'all',
|
|
651
|
+
) ? (
|
|
652
|
+
<Button variant="ghost" onClick={resetFilters}>
|
|
653
|
+
Reset filters
|
|
654
|
+
</Button>
|
|
655
|
+
) : null}
|
|
656
|
+
</div>
|
|
657
|
+
) : null}
|
|
658
|
+
|
|
659
|
+
{runs.length > 0 ? (
|
|
660
|
+
<ul
|
|
661
|
+
className="scrollbar overflow-x-auto rounded-xl border bg-card text-card-foreground"
|
|
662
|
+
aria-label="Backup activity"
|
|
663
|
+
>
|
|
664
|
+
{runs.map(({ type, record, source }) => {
|
|
665
|
+
const run = source
|
|
666
|
+
const policy = backupConfigs.find(
|
|
667
|
+
(config) => config.id === run?.configId,
|
|
668
|
+
)
|
|
669
|
+
const environment = context.environments.find(
|
|
670
|
+
(item) => item.id === record.environmentId,
|
|
671
|
+
)
|
|
672
|
+
const started = record.startedAt ?? record.createdAt
|
|
673
|
+
return (
|
|
674
|
+
<li
|
|
675
|
+
key={`${type}:${record.id}`}
|
|
676
|
+
data-backup-activity={type}
|
|
677
|
+
className="flex h-11 min-w-[36rem] items-center gap-4 border-b px-4 text-sm whitespace-nowrap last:border-b-0 hover:bg-muted/50 md:min-w-[52rem]"
|
|
678
|
+
>
|
|
679
|
+
<Tooltip>
|
|
680
|
+
<TooltipTrigger asChild>
|
|
681
|
+
<span
|
|
682
|
+
role="status"
|
|
683
|
+
aria-label={`${type === 'backup' ? 'Backup' : 'Restore'} ${record.status}`}
|
|
684
|
+
className="inline-flex w-fit"
|
|
685
|
+
>
|
|
686
|
+
<BackupStatusIcon status={record.status} />
|
|
687
|
+
</span>
|
|
688
|
+
</TooltipTrigger>
|
|
689
|
+
<TooltipContent>
|
|
690
|
+
{formatStatus(record.status)}
|
|
691
|
+
</TooltipContent>
|
|
692
|
+
</Tooltip>
|
|
693
|
+
<Tooltip>
|
|
694
|
+
<TooltipTrigger asChild>
|
|
695
|
+
<Badge variant="secondary">
|
|
696
|
+
{type === 'backup' ? (
|
|
697
|
+
<ArrowDownIcon data-icon="inline-start" />
|
|
698
|
+
) : (
|
|
699
|
+
<Undo2Icon data-icon="inline-start" />
|
|
700
|
+
)}
|
|
701
|
+
{type === 'backup' ? 'Backup' : 'Restore'}
|
|
702
|
+
</Badge>
|
|
703
|
+
</TooltipTrigger>
|
|
704
|
+
<TooltipContent>Type</TooltipContent>
|
|
705
|
+
</Tooltip>
|
|
706
|
+
<Tooltip>
|
|
707
|
+
<TooltipTrigger asChild>
|
|
708
|
+
<span className="shrink-0 font-mono text-[13px] font-medium">
|
|
709
|
+
{record.id.slice(0, 7)}
|
|
710
|
+
</span>
|
|
711
|
+
</TooltipTrigger>
|
|
712
|
+
<TooltipContent>
|
|
713
|
+
{type === 'backup' ? 'Backup ID' : 'Restore ID'}
|
|
714
|
+
</TooltipContent>
|
|
715
|
+
</Tooltip>
|
|
716
|
+
<Tooltip>
|
|
717
|
+
<TooltipTrigger asChild>
|
|
718
|
+
{policy ? (
|
|
719
|
+
<Link
|
|
720
|
+
to="/$teamSlug/projects/$projectName/backups"
|
|
721
|
+
params={{ teamSlug, projectName }}
|
|
722
|
+
search={{ ...filters, policy: policy.id }}
|
|
723
|
+
hash="activity"
|
|
724
|
+
className="min-w-20 max-w-48 truncate text-muted-foreground transition-colors hover:text-foreground"
|
|
725
|
+
>
|
|
726
|
+
{policy.name}
|
|
727
|
+
</Link>
|
|
728
|
+
) : (
|
|
729
|
+
<span className="min-w-20 max-w-48 truncate text-muted-foreground">
|
|
730
|
+
Deleted policy
|
|
731
|
+
</span>
|
|
732
|
+
)}
|
|
733
|
+
</TooltipTrigger>
|
|
734
|
+
<TooltipContent>Policy</TooltipContent>
|
|
735
|
+
</Tooltip>
|
|
736
|
+
<BackupTimestamp value={started} />
|
|
737
|
+
<Tooltip>
|
|
738
|
+
<TooltipTrigger asChild>
|
|
739
|
+
<Link
|
|
740
|
+
to="/$teamSlug/projects/$projectName/backups"
|
|
741
|
+
params={{ teamSlug, projectName }}
|
|
742
|
+
search={{
|
|
743
|
+
...filters,
|
|
744
|
+
environment: record.environmentId,
|
|
745
|
+
}}
|
|
746
|
+
aria-label="Filter history by environment"
|
|
747
|
+
className="inline-flex min-w-16 max-w-32 items-center gap-2 text-muted-foreground transition-colors hover:text-foreground"
|
|
748
|
+
>
|
|
749
|
+
<EnvironmentDot
|
|
750
|
+
color={
|
|
751
|
+
environment?.color ??
|
|
752
|
+
run?.environmentColor ??
|
|
753
|
+
'neutral'
|
|
754
|
+
}
|
|
755
|
+
/>
|
|
756
|
+
<span className="truncate">
|
|
757
|
+
{environment?.name ??
|
|
758
|
+
run?.environmentName ??
|
|
759
|
+
'Unknown environment'}
|
|
760
|
+
</span>
|
|
761
|
+
</Link>
|
|
762
|
+
</TooltipTrigger>
|
|
763
|
+
<TooltipContent>Environment</TooltipContent>
|
|
764
|
+
</Tooltip>
|
|
765
|
+
{type === 'backup' &&
|
|
766
|
+
run?.configId &&
|
|
767
|
+
latestBackupRuns.get(run.configId)?.id === run.id ? (
|
|
768
|
+
<Tooltip>
|
|
769
|
+
<TooltipTrigger asChild>
|
|
770
|
+
<Badge variant="secondary">Latest</Badge>
|
|
771
|
+
</TooltipTrigger>
|
|
772
|
+
<TooltipContent>
|
|
773
|
+
Latest backup for this policy
|
|
774
|
+
</TooltipContent>
|
|
775
|
+
</Tooltip>
|
|
776
|
+
) : null}
|
|
777
|
+
<div className="ml-auto shrink-0">
|
|
778
|
+
<ButtonGroup
|
|
779
|
+
className="-mr-2 shrink-0"
|
|
780
|
+
aria-label="Operation actions"
|
|
781
|
+
>
|
|
782
|
+
{canManage && type === 'backup' && run ? (
|
|
783
|
+
<BackupRunRestoreActions
|
|
784
|
+
projectId={context.project.id}
|
|
785
|
+
policyName={policy?.name}
|
|
786
|
+
targetServerName={
|
|
787
|
+
context.servers.find(
|
|
788
|
+
(server) =>
|
|
789
|
+
server.id === environment?.effectiveServerId,
|
|
790
|
+
)?.name ?? 'No server assigned'
|
|
791
|
+
}
|
|
792
|
+
targetServerStatus={
|
|
793
|
+
context.servers.find(
|
|
794
|
+
(server) =>
|
|
795
|
+
server.id === environment?.effectiveServerId,
|
|
796
|
+
)?.status
|
|
797
|
+
}
|
|
798
|
+
artifacts={run.artifacts}
|
|
799
|
+
disabled={
|
|
800
|
+
actionBusy ||
|
|
801
|
+
context.backupRestores.some(
|
|
802
|
+
(restore) =>
|
|
803
|
+
restore.environmentId === run.environmentId &&
|
|
804
|
+
['queued', 'running'].includes(restore.status),
|
|
805
|
+
)
|
|
806
|
+
}
|
|
807
|
+
restoringRunId={restoringRunId}
|
|
808
|
+
run={run}
|
|
809
|
+
onRestore={restoreBackup}
|
|
810
|
+
/>
|
|
811
|
+
) : null}
|
|
812
|
+
<DropdownMenu>
|
|
813
|
+
<DropdownMenuTrigger asChild>
|
|
814
|
+
<Button
|
|
815
|
+
variant="outline"
|
|
816
|
+
size="icon-sm"
|
|
817
|
+
aria-label={
|
|
818
|
+
type === 'backup'
|
|
819
|
+
? 'Backup actions'
|
|
820
|
+
: 'Restore actions'
|
|
821
|
+
}
|
|
822
|
+
>
|
|
823
|
+
<EllipsisVerticalIcon />
|
|
824
|
+
</Button>
|
|
825
|
+
</DropdownMenuTrigger>
|
|
826
|
+
<DropdownMenuContent align="end">
|
|
827
|
+
{type === 'restore' ? (
|
|
828
|
+
<DropdownMenuItem
|
|
829
|
+
onSelect={() => setDetailsRestore(record)}
|
|
830
|
+
>
|
|
831
|
+
Details
|
|
832
|
+
</DropdownMenuItem>
|
|
833
|
+
) : null}
|
|
834
|
+
<DropdownMenuItem
|
|
835
|
+
onSelect={() =>
|
|
836
|
+
setLogOperation({
|
|
837
|
+
type,
|
|
838
|
+
id: record.id,
|
|
839
|
+
errorMessage: record.errorMessage,
|
|
840
|
+
})
|
|
841
|
+
}
|
|
842
|
+
>
|
|
843
|
+
{type === 'backup' ? 'Backup logs' : 'Restore logs'}
|
|
844
|
+
</DropdownMenuItem>
|
|
845
|
+
</DropdownMenuContent>
|
|
846
|
+
</DropdownMenu>
|
|
847
|
+
</ButtonGroup>
|
|
848
|
+
</div>
|
|
849
|
+
</li>
|
|
850
|
+
)
|
|
851
|
+
})}
|
|
852
|
+
</ul>
|
|
853
|
+
) : (
|
|
854
|
+
<Empty className="min-h-60 border bg-card text-card-foreground">
|
|
855
|
+
<EmptyHeader>
|
|
856
|
+
<EmptyTitle>
|
|
857
|
+
{backupRuns.length || context.backupRestores.length
|
|
858
|
+
? 'No matching activity.'
|
|
859
|
+
: 'No backup history yet.'}
|
|
860
|
+
</EmptyTitle>
|
|
861
|
+
<EmptyDescription>
|
|
862
|
+
Run a policy or wait for its next scheduled backup. Clear
|
|
863
|
+
filters to see other activity.
|
|
864
|
+
</EmptyDescription>
|
|
865
|
+
</EmptyHeader>
|
|
866
|
+
</Empty>
|
|
867
|
+
)}
|
|
868
|
+
</section>
|
|
869
|
+
<BackupJobLogs
|
|
870
|
+
operation={logOperation}
|
|
871
|
+
teamSlug={teamSlug}
|
|
872
|
+
onClose={() => setLogOperation(null)}
|
|
873
|
+
/>
|
|
874
|
+
</>
|
|
875
|
+
)
|
|
876
|
+
}
|