insforge 1.3.0 → 1.4.8
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/CHANGELOG.md +2 -0
- package/auth/package.json +5 -3
- package/auth/src/lib/broadcastService.ts +115 -117
- package/auth/src/lib/insforge.ts +8 -0
- package/auth/src/main.tsx +2 -4
- package/auth/src/pages/SignInPage.tsx +60 -60
- package/auth/src/pages/SignUpPage.tsx +60 -60
- package/auth/src/pages/VerifyEmailPage.tsx +18 -0
- package/auth/tsconfig.json +2 -1
- package/backend/package.json +10 -6
- package/backend/src/api/middlewares/rate-limiters.ts +127 -127
- package/backend/src/api/routes/ai/index.routes.ts +475 -468
- package/backend/src/api/routes/auth/index.routes.ts +85 -32
- package/backend/src/api/routes/auth/oauth.routes.ts +11 -6
- package/backend/src/api/routes/database/index.routes.ts +2 -0
- package/backend/src/api/routes/database/records.routes.ts +39 -175
- package/backend/src/api/routes/database/rpc.routes.ts +69 -0
- package/backend/src/api/routes/deployments/index.routes.ts +192 -0
- package/backend/src/api/routes/docs/index.routes.ts +3 -2
- package/backend/src/api/routes/email/index.routes.ts +35 -35
- package/backend/src/api/routes/functions/index.routes.ts +3 -3
- package/backend/src/api/routes/metadata/index.routes.ts +26 -0
- package/backend/src/api/routes/webhooks/index.routes.ts +109 -0
- package/backend/src/infra/database/database.manager.ts +0 -10
- package/backend/src/infra/database/migrations/018_schema-rework.sql +441 -0
- package/backend/src/infra/database/migrations/019_create-deployments-table.sql +36 -0
- package/backend/src/infra/database/migrations/020_add-audio-modality.sql +11 -0
- package/backend/src/infra/database/migrations/bootstrap/bootstrap-migrations.js +103 -0
- package/backend/src/infra/security/token.manager.ts +1 -4
- package/backend/src/providers/ai/openrouter.provider.ts +12 -3
- package/backend/src/providers/database/base.provider.ts +39 -0
- package/backend/src/providers/database/cloud.provider.ts +159 -0
- package/backend/src/providers/deployments/vercel.provider.ts +516 -0
- package/backend/src/server.ts +19 -7
- package/backend/src/services/ai/ai-config.service.ts +6 -6
- package/backend/src/services/ai/ai-model.service.ts +60 -60
- package/backend/src/services/ai/ai-usage.service.ts +7 -7
- package/backend/src/services/ai/chat-completion.service.ts +415 -220
- package/backend/src/services/ai/helpers.ts +64 -64
- package/backend/src/services/ai/index.ts +13 -13
- package/backend/src/services/auth/auth-config.service.ts +4 -4
- package/backend/src/services/auth/auth-otp.service.ts +6 -6
- package/backend/src/services/auth/auth.service.ts +134 -74
- package/backend/src/services/auth/index.ts +4 -4
- package/backend/src/services/auth/oauth-config.service.ts +12 -12
- package/backend/src/services/database/database-advance.service.ts +19 -55
- package/backend/src/services/database/database-table.service.ts +38 -85
- package/backend/src/services/database/postgrest-proxy.service.ts +165 -0
- package/backend/src/services/deployments/deployment.service.ts +693 -0
- package/backend/src/services/functions/function.service.ts +61 -41
- package/backend/src/services/logs/audit.service.ts +10 -10
- package/backend/src/services/secrets/secret.service.ts +101 -27
- package/backend/src/services/storage/storage.service.ts +30 -30
- package/backend/src/services/usage/usage.service.ts +6 -6
- package/backend/src/types/ai.ts +8 -0
- package/backend/src/types/auth.ts +5 -1
- package/backend/src/types/database.ts +2 -0
- package/backend/src/types/deployments.ts +33 -0
- package/backend/src/types/storage.ts +1 -1
- package/backend/src/types/webhooks.ts +45 -0
- package/backend/src/utils/cookies.ts +34 -35
- package/backend/src/utils/environment.ts +0 -14
- package/backend/src/utils/s3-config-loader.ts +64 -64
- package/backend/src/utils/seed.ts +334 -301
- package/backend/src/utils/sql-parser.ts +126 -0
- package/backend/src/utils/utils.ts +114 -114
- package/backend/src/utils/validations.ts +10 -10
- package/backend/tests/local/test-rpc.sh +141 -0
- package/backend/tests/local/test-secrets.sh +1 -1
- package/backend/tests/manual/test-ai-model-plugins.sh +258 -0
- package/backend/tests/manual/test-rawsql-modes.sh +24 -24
- package/backend/tests/unit/database-advance.test.ts +326 -0
- package/backend/tests/unit/helpers.test.ts +2 -2
- package/claude-plugin/skills/insforge-schema-patterns/SKILL.md +13 -10
- package/docker-compose.prod.yml +1 -1
- package/docker-compose.yml +1 -1
- package/docs/agent-docs/deployment.md +79 -0
- package/docs/changelog.mdx +165 -72
- package/docs/core-concepts/ai/architecture.mdx +1 -23
- package/docs/core-concepts/ai/sdk.mdx +26 -1
- package/docs/core-concepts/authentication/architecture.mdx +6 -8
- package/docs/core-concepts/authentication/sdk.mdx +387 -91
- package/docs/core-concepts/authentication/ui-components/customization.mdx +460 -256
- package/docs/core-concepts/authentication/ui-components/nextjs.mdx +50 -24
- package/docs/core-concepts/authentication/ui-components/react-router.mdx +18 -19
- package/docs/core-concepts/authentication/ui-components/react.mdx +26 -19
- package/docs/core-concepts/database/architecture.mdx +58 -21
- package/docs/core-concepts/database/pgvector.mdx +138 -0
- package/docs/core-concepts/database/sdk.mdx +17 -17
- package/docs/core-concepts/deployments/architecture.mdx +152 -0
- package/docs/core-concepts/email/architecture.mdx +4 -2
- package/docs/core-concepts/functions/architecture.mdx +1 -1
- package/docs/core-concepts/functions/sdk.mdx +0 -1
- package/docs/core-concepts/realtime/architecture.mdx +1 -1
- package/docs/core-concepts/storage/architecture.mdx +1 -1
- package/docs/core-concepts/storage/sdk.mdx +25 -25
- package/docs/docs.json +14 -6
- package/docs/favicon.png +0 -0
- package/docs/favicon.svg +3 -18
- package/docs/images/changelog/dec-2025/apple-oauth.mp4 +0 -0
- package/docs/images/changelog/dec-2025/moreModels.png +0 -0
- package/docs/images/changelog/dec-2025/multi-region.webp +0 -0
- package/docs/images/changelog/dec-2025/postgres-connection.webp +0 -0
- package/docs/images/changelog/dec-2025/realtime2.png +0 -0
- package/docs/images/mcp-setup/CC-MCP-1.mp4 +0 -0
- package/docs/images/mcp-setup/CC-MCP-2.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-1.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-2.mp4 +0 -0
- package/docs/images/mcp-setup/Cursor-MCP-3.mp4 +0 -0
- package/docs/images/mcp-setup/claude-code-connect.png +0 -0
- package/docs/images/mcp-setup/cline-1.png +0 -0
- package/docs/images/mcp-setup/cline-2.png +0 -0
- package/docs/images/mcp-setup/cline-3.png +0 -0
- package/docs/images/mcp-setup/connect-project.png +0 -0
- package/docs/images/mcp-setup/copilot-1.png +0 -0
- package/docs/images/mcp-setup/copilot-2.png +0 -0
- package/docs/images/mcp-setup/copilot-3.png +0 -0
- package/docs/images/mcp-setup/mcp-json-1.png +0 -0
- package/docs/images/mcp-setup/mcp-json-2.png +0 -0
- package/docs/images/mcp-setup/qoder-1.png +0 -0
- package/docs/images/mcp-setup/qoder-2.png +0 -0
- package/docs/images/mcp-setup/roocode-1.png +0 -0
- package/docs/images/mcp-setup/roocode-2.png +0 -0
- package/docs/images/mcp-setup/trae-1.png +0 -0
- package/docs/images/mcp-setup/trae-2.png +0 -0
- package/docs/images/mcp-setup/trae-3.png +0 -0
- package/docs/images/mcp-setup/trae-4.png +0 -0
- package/docs/images/mcp-setup/trae-5.png +0 -0
- package/docs/images/mcp-setup/windsurf-1.png +0 -0
- package/docs/images/mcp-setup/windsurf-2.png +0 -0
- package/docs/insforge-instructions-sdk.md +7 -3
- package/docs/introduction.mdx +9 -8
- package/docs/mcp-setup.mdx +332 -0
- package/docs/oauth-server.mdx +563 -0
- package/docs/partnership.mdx +79 -10
- package/docs/quickstart.mdx +1 -1
- package/docs/vscode-extension.mdx +74 -0
- package/eslint.config.js +1 -0
- package/examples/response-examples.md +1 -1
- package/frontend/package.json +1 -1
- package/frontend/src/App.tsx +8 -3
- package/frontend/src/assets/logos/antigravity.svg +1 -0
- package/frontend/src/assets/logos/copilot.svg +10 -0
- package/frontend/src/assets/logos/deepseek.svg +139 -0
- package/frontend/src/assets/logos/kiro.svg +9 -0
- package/frontend/src/assets/logos/qoder.svg +4 -0
- package/frontend/src/assets/logos/qwen.svg +15 -0
- package/frontend/src/components/CodeBlock.tsx +2 -2
- package/frontend/src/components/ConnectCTA.tsx +3 -2
- package/frontend/src/components/datagrid/DataGrid.tsx +90 -62
- package/frontend/src/components/datagrid/datagridTypes.tsx +2 -1
- package/frontend/src/components/datagrid/index.ts +1 -1
- package/frontend/src/components/index.ts +0 -1
- package/frontend/src/components/layout/AppHeader.tsx +4 -27
- package/frontend/src/components/layout/AppSidebar.tsx +85 -100
- package/frontend/src/components/layout/Layout.tsx +34 -32
- package/frontend/src/components/layout/PrimaryMenu.tsx +12 -4
- package/frontend/src/components/radix/Select.tsx +151 -151
- package/frontend/src/features/ai/components/AIConfigCard.tsx +200 -200
- package/frontend/src/features/ai/components/AIEmptyState.tsx +23 -23
- package/frontend/src/features/ai/components/ModalityFilterSidebar.tsx +102 -101
- package/frontend/src/features/ai/components/ModelSelectionDialog.tsx +135 -135
- package/frontend/src/features/ai/components/ModelSelectionGrid.tsx +51 -51
- package/frontend/src/features/ai/components/SystemPromptDialog.tsx +118 -118
- package/frontend/src/features/ai/components/index.ts +6 -6
- package/frontend/src/features/ai/helpers.ts +147 -141
- package/frontend/src/features/ai/pages/AIPage.tsx +166 -166
- package/frontend/src/features/auth/components/AuthPreview.tsx +96 -96
- package/frontend/src/features/auth/components/UsersDataGrid.tsx +55 -31
- package/frontend/src/features/auth/components/index.ts +5 -5
- package/frontend/src/features/auth/pages/AuthMethodsPage.tsx +275 -275
- package/frontend/src/features/dashboard/pages/DashboardPage.tsx +1 -1
- package/frontend/src/features/database/components/DatabaseDataGrid.tsx +0 -2
- package/frontend/src/features/database/components/ForeignKeyCell.tsx +38 -11
- package/frontend/src/features/database/components/ForeignKeyPopover.tsx +18 -8
- package/frontend/src/features/database/components/LinkRecordModal.tsx +61 -13
- package/frontend/src/features/database/components/RecordFormField.tsx +1 -1
- package/frontend/src/features/database/components/TableSidebar.tsx +0 -3
- package/frontend/src/features/database/components/TablesEmptyState.tsx +1 -1
- package/frontend/src/features/database/components/TemplatePreview.tsx +1 -2
- package/frontend/src/features/database/constants.ts +16 -28
- package/frontend/src/features/database/hooks/useCSVImport.ts +3 -2
- package/frontend/src/features/database/hooks/useRawSQL.ts +3 -2
- package/frontend/src/features/database/hooks/useTables.ts +5 -7
- package/frontend/src/features/database/pages/FunctionsPage.tsx +0 -5
- package/frontend/src/features/database/pages/IndexesPage.tsx +0 -5
- package/frontend/src/features/database/pages/PoliciesPage.tsx +0 -5
- package/frontend/src/features/database/pages/SQLEditorPage.tsx +2 -2
- package/frontend/src/features/database/pages/TriggersPage.tsx +0 -5
- package/frontend/src/features/database/services/advance.service.ts +1 -15
- package/frontend/src/features/database/services/record.service.ts +4 -20
- package/frontend/src/features/database/services/table.service.ts +1 -4
- package/frontend/src/features/database/templates/ai-chatbot.ts +6 -6
- package/frontend/src/features/database/templates/ecommerce-platform.ts +2 -2
- package/frontend/src/features/database/templates/instagram-clone.ts +10 -10
- package/frontend/src/features/database/templates/notion-clone.ts +8 -8
- package/frontend/src/features/database/templates/reddit-clone.ts +10 -10
- package/frontend/src/features/deployments/components/DeploymentRow.tsx +93 -0
- package/frontend/src/features/deployments/components/DeploymentsEmptyState.tsx +15 -0
- package/frontend/src/features/deployments/hooks/useDeployments.ts +157 -0
- package/frontend/src/features/deployments/pages/DeploymentsPage.tsx +318 -0
- package/frontend/src/features/deployments/services/deployments.service.ts +63 -0
- package/frontend/src/features/functions/components/FunctionRow.tsx +72 -72
- package/frontend/src/features/functions/components/FunctionsSidebar.tsx +56 -56
- package/frontend/src/features/functions/components/SecretRow.tsx +3 -3
- package/frontend/src/features/functions/components/index.ts +5 -5
- package/frontend/src/features/functions/hooks/useFunctions.ts +5 -4
- package/frontend/src/features/functions/hooks/useSecrets.ts +6 -9
- package/frontend/src/features/functions/pages/SecretsPage.tsx +118 -118
- package/frontend/src/features/functions/services/function.service.ts +8 -25
- package/frontend/src/features/functions/services/secret.service.ts +23 -41
- package/frontend/src/features/login/pages/CloudLoginPage.tsx +125 -118
- package/frontend/src/features/logs/components/LogDetailPanel.tsx +41 -0
- package/frontend/src/features/logs/components/LogsDataGrid.tsx +32 -1
- package/frontend/src/features/logs/components/index.ts +1 -0
- package/frontend/src/features/logs/pages/LogsPage.tsx +36 -6
- package/frontend/src/features/onboard/components/ApiCredentialsSection.tsx +59 -0
- package/frontend/src/features/onboard/components/ConnectionStringSection.tsx +180 -0
- package/frontend/src/features/onboard/components/McpConnectionSection.tsx +159 -0
- package/frontend/src/features/onboard/components/OnboardingController.tsx +68 -0
- package/frontend/src/features/onboard/components/OnboardingModal.tsx +121 -267
- package/frontend/src/features/onboard/components/ShowPasswordButton.tsx +21 -0
- package/frontend/src/features/onboard/components/index.ts +9 -4
- package/frontend/src/features/onboard/components/mcp/CursorDeeplinkGenerator.tsx +1 -1
- package/frontend/src/features/onboard/components/mcp/QoderDeeplinkGenerator.tsx +36 -0
- package/frontend/src/features/onboard/components/mcp/helpers.tsx +123 -98
- package/frontend/src/features/onboard/components/mcp/index.ts +4 -3
- package/frontend/src/features/onboard/index.ts +17 -13
- package/frontend/src/features/settings/pages/SettingsPage.tsx +349 -0
- package/frontend/src/features/visualizer/components/AuthNode.tsx +4 -4
- package/frontend/src/features/visualizer/components/SchemaVisualizer.tsx +21 -8
- package/frontend/src/features/visualizer/pages/VisualizerPage.tsx +10 -1
- package/frontend/src/index.css +249 -249
- package/frontend/src/lib/contexts/ModalContext.tsx +35 -0
- package/frontend/src/lib/hooks/useMetadata.ts +45 -1
- package/frontend/src/lib/hooks/useModal.tsx +2 -0
- package/frontend/src/lib/routing/AppRoutes.tsx +103 -99
- package/frontend/src/lib/services/metadata.service.ts +20 -3
- package/frontend/src/lib/utils/menuItems.ts +223 -207
- package/frontend/src/lib/utils/utils.ts +196 -196
- package/functions/server.ts +315 -315
- package/functions/worker-template.js +1 -1
- package/openapi/ai.yaml +115 -5
- package/openapi/auth.yaml +97 -17
- package/openapi/logs.yaml +0 -2
- package/openapi/metadata.yaml +0 -2
- package/openapi/records.yaml +21 -21
- package/openapi/tables.yaml +1 -2
- package/package.json +1 -1
- package/shared-schemas/package.json +1 -1
- package/shared-schemas/src/ai-api.schema.ts +251 -143
- package/shared-schemas/src/ai.schema.ts +63 -63
- package/shared-schemas/src/auth-api.schema.ts +34 -6
- package/shared-schemas/src/auth.schema.ts +17 -10
- package/shared-schemas/src/cloud-events.schema.ts +26 -0
- package/shared-schemas/src/deployments-api.schema.ts +55 -0
- package/shared-schemas/src/deployments.schema.ts +30 -0
- package/shared-schemas/src/docs.schema.ts +8 -2
- package/shared-schemas/src/email-api.schema.ts +30 -30
- package/shared-schemas/src/functions-api.schema.ts +13 -4
- package/shared-schemas/src/functions.schema.ts +1 -1
- package/shared-schemas/src/index.ts +22 -18
- package/shared-schemas/src/metadata.schema.ts +30 -4
- package/shared-schemas/src/secrets-api.schema.ts +44 -0
- package/shared-schemas/src/secrets.schema.ts +15 -0
- package/zeabur/README.md +13 -0
- package/zeabur/template.yml +20 -51
- package/backend/src/types/profile.ts +0 -55
- package/frontend/src/components/ProjectInfoModal.tsx +0 -128
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { ChevronRight, ExternalLink } from 'lucide-react';
|
|
3
|
+
import RefreshIcon from '@/assets/icons/refresh.svg?react';
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
ConfirmDialog,
|
|
7
|
+
PaginationControls,
|
|
8
|
+
Skeleton,
|
|
9
|
+
Tooltip,
|
|
10
|
+
TooltipContent,
|
|
11
|
+
TooltipProvider,
|
|
12
|
+
TooltipTrigger,
|
|
13
|
+
} from '@/components';
|
|
14
|
+
import { useConfirm } from '@/lib/hooks/useConfirm';
|
|
15
|
+
import { useDeployments } from '../hooks/useDeployments';
|
|
16
|
+
import { DeploymentRow } from '../components/DeploymentRow';
|
|
17
|
+
import DeploymentsEmptyState from '../components/DeploymentsEmptyState';
|
|
18
|
+
import type { DeploymentSchema } from '../services/deployments.service';
|
|
19
|
+
import { formatTime } from '@/lib/utils/utils';
|
|
20
|
+
|
|
21
|
+
const statusColors: Record<string, string> = {
|
|
22
|
+
WAITING: 'bg-yellow-600',
|
|
23
|
+
UPLOADING: 'bg-blue-600',
|
|
24
|
+
QUEUED: 'bg-purple-600',
|
|
25
|
+
BUILDING: 'bg-sky-600',
|
|
26
|
+
READY: 'bg-green-600',
|
|
27
|
+
ERROR: 'bg-red-600',
|
|
28
|
+
CANCELED: 'bg-gray-500',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default function DeploymentsPage() {
|
|
32
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
33
|
+
const [selectedDeployment, setSelectedDeployment] = useState<DeploymentSchema | null>(null);
|
|
34
|
+
|
|
35
|
+
const { confirm, confirmDialogProps } = useConfirm();
|
|
36
|
+
|
|
37
|
+
const {
|
|
38
|
+
deployments,
|
|
39
|
+
totalDeployments,
|
|
40
|
+
isLoadingDeployments,
|
|
41
|
+
refetchDeployments,
|
|
42
|
+
syncDeployment,
|
|
43
|
+
cancelDeployment,
|
|
44
|
+
isSyncing,
|
|
45
|
+
isCancelling,
|
|
46
|
+
pageSize,
|
|
47
|
+
currentPage,
|
|
48
|
+
totalPages,
|
|
49
|
+
setPage,
|
|
50
|
+
} = useDeployments();
|
|
51
|
+
|
|
52
|
+
const handlePageChange = (page: number) => {
|
|
53
|
+
setPage(page);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleRefresh = async () => {
|
|
57
|
+
setIsRefreshing(true);
|
|
58
|
+
try {
|
|
59
|
+
await refetchDeployments();
|
|
60
|
+
} finally {
|
|
61
|
+
setIsRefreshing(false);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleSync = (id: string) => {
|
|
66
|
+
syncDeployment(id);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleCancel = async (id: string) => {
|
|
70
|
+
const shouldCancel = await confirm({
|
|
71
|
+
title: 'Cancel Deployment',
|
|
72
|
+
description: 'Are you sure you want to cancel this deployment? This action cannot be undone.',
|
|
73
|
+
confirmText: 'Confirm',
|
|
74
|
+
cancelText: 'Dismiss',
|
|
75
|
+
destructive: true,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (shouldCancel) {
|
|
79
|
+
cancelDeployment(id);
|
|
80
|
+
setSelectedDeployment(null);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Deployment detail view
|
|
85
|
+
if (selectedDeployment) {
|
|
86
|
+
const statusColor = statusColors[selectedDeployment.status] || 'bg-gray-500';
|
|
87
|
+
const canCancel = ['WAITING', 'UPLOADING', 'QUEUED', 'BUILDING'].includes(
|
|
88
|
+
selectedDeployment.status
|
|
89
|
+
);
|
|
90
|
+
const canSync = !!selectedDeployment.providerDeploymentId;
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<div className="h-full flex flex-col overflow-hidden">
|
|
94
|
+
<div className="flex items-center justify-between gap-2.5 p-4 border-b border-border-gray dark:border-neutral-600">
|
|
95
|
+
<div className="flex items-center gap-2.5">
|
|
96
|
+
<button
|
|
97
|
+
onClick={() => setSelectedDeployment(null)}
|
|
98
|
+
className="text-xl text-zinc-500 dark:text-neutral-400 hover:text-zinc-950 dark:hover:text-white transition-colors"
|
|
99
|
+
>
|
|
100
|
+
Deployments
|
|
101
|
+
</button>
|
|
102
|
+
<ChevronRight className="w-5 h-5 text-muted-foreground dark:text-neutral-400" />
|
|
103
|
+
<p className="text-xl text-zinc-950 dark:text-white font-mono">
|
|
104
|
+
{selectedDeployment.id}
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div className="flex items-center gap-2">
|
|
109
|
+
{canSync && (
|
|
110
|
+
<Button
|
|
111
|
+
variant="secondary"
|
|
112
|
+
size="sm"
|
|
113
|
+
onClick={() => handleSync(selectedDeployment.id)}
|
|
114
|
+
disabled={isSyncing}
|
|
115
|
+
>
|
|
116
|
+
{isSyncing ? 'Syncing...' : 'Sync Status'}
|
|
117
|
+
</Button>
|
|
118
|
+
)}
|
|
119
|
+
{canCancel && (
|
|
120
|
+
<Button
|
|
121
|
+
variant="destructive"
|
|
122
|
+
size="sm"
|
|
123
|
+
onClick={() => void handleCancel(selectedDeployment.id)}
|
|
124
|
+
disabled={isCancelling}
|
|
125
|
+
>
|
|
126
|
+
{isCancelling ? 'Cancelling...' : 'Cancel'}
|
|
127
|
+
</Button>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div className="flex-1 min-h-0 p-4 overflow-auto">
|
|
133
|
+
<div className="space-y-4">
|
|
134
|
+
<div className="grid grid-cols-3 gap-4">
|
|
135
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
136
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">ID</p>
|
|
137
|
+
<p className="text-sm text-zinc-950 dark:text-white font-mono break-all">
|
|
138
|
+
{selectedDeployment.id}
|
|
139
|
+
</p>
|
|
140
|
+
</div>
|
|
141
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
142
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">Status</p>
|
|
143
|
+
<span
|
|
144
|
+
className={`inline-flex items-center justify-center h-5 px-2 rounded-sm text-xs font-medium text-white ${statusColor}`}
|
|
145
|
+
>
|
|
146
|
+
{selectedDeployment.status}
|
|
147
|
+
</span>
|
|
148
|
+
</div>
|
|
149
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
150
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">Provider</p>
|
|
151
|
+
<p className="text-sm text-zinc-950 dark:text-white capitalize">
|
|
152
|
+
{selectedDeployment.provider}
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div className="grid grid-cols-3 gap-4">
|
|
158
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
159
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">
|
|
160
|
+
Provider Deployment ID
|
|
161
|
+
</p>
|
|
162
|
+
<p className="text-sm text-zinc-950 dark:text-white font-mono break-all">
|
|
163
|
+
{selectedDeployment.providerDeploymentId || '—'}
|
|
164
|
+
</p>
|
|
165
|
+
</div>
|
|
166
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
167
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">Created</p>
|
|
168
|
+
<p className="text-sm text-zinc-950 dark:text-white">
|
|
169
|
+
{formatTime(selectedDeployment.createdAt)}
|
|
170
|
+
</p>
|
|
171
|
+
</div>
|
|
172
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
173
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-1">Updated</p>
|
|
174
|
+
<p className="text-sm text-zinc-950 dark:text-white">
|
|
175
|
+
{formatTime(selectedDeployment.updatedAt)}
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
{selectedDeployment.url && (
|
|
181
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
182
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-2">URL</p>
|
|
183
|
+
<a
|
|
184
|
+
href={
|
|
185
|
+
selectedDeployment.url.startsWith('http')
|
|
186
|
+
? selectedDeployment.url
|
|
187
|
+
: `https://${selectedDeployment.url}`
|
|
188
|
+
}
|
|
189
|
+
target="_blank"
|
|
190
|
+
rel="noopener noreferrer"
|
|
191
|
+
className="text-sm text-blue-600 dark:text-blue-400 hover:underline flex items-center gap-1"
|
|
192
|
+
>
|
|
193
|
+
{selectedDeployment.url}
|
|
194
|
+
<ExternalLink className="w-3 h-3" />
|
|
195
|
+
</a>
|
|
196
|
+
</div>
|
|
197
|
+
)}
|
|
198
|
+
|
|
199
|
+
{selectedDeployment.metadata && Object.keys(selectedDeployment.metadata).length > 0 && (
|
|
200
|
+
<div className="p-4 rounded-lg bg-neutral-100 dark:bg-[#333333]">
|
|
201
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400 mb-2">Metadata</p>
|
|
202
|
+
<pre className="text-sm text-zinc-950 dark:text-white font-mono whitespace-pre-wrap overflow-auto">
|
|
203
|
+
{JSON.stringify(selectedDeployment.metadata, null, 2)}
|
|
204
|
+
</pre>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<ConfirmDialog {...confirmDialogProps} />
|
|
211
|
+
</div>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Default list view
|
|
216
|
+
return (
|
|
217
|
+
<div className="h-full flex flex-col overflow-hidden">
|
|
218
|
+
{/* Fixed Page Header */}
|
|
219
|
+
<div className="shrink-0 flex flex-col gap-1 p-4 pb-0">
|
|
220
|
+
<div className="flex items-center gap-3">
|
|
221
|
+
<h1 className="text-xl font-normal text-zinc-950 dark:text-white">Deployments</h1>
|
|
222
|
+
|
|
223
|
+
{/* Separator */}
|
|
224
|
+
<div className="h-6 w-px bg-gray-200 dark:bg-neutral-700" />
|
|
225
|
+
|
|
226
|
+
{/* Refresh button */}
|
|
227
|
+
<TooltipProvider>
|
|
228
|
+
<Tooltip>
|
|
229
|
+
<TooltipTrigger asChild>
|
|
230
|
+
<Button
|
|
231
|
+
variant="ghost"
|
|
232
|
+
size="icon"
|
|
233
|
+
className="p-1 h-9 w-9"
|
|
234
|
+
onClick={() => void handleRefresh()}
|
|
235
|
+
disabled={isRefreshing}
|
|
236
|
+
>
|
|
237
|
+
<RefreshIcon className="h-5 w-5 text-zinc-400 dark:text-neutral-400" />
|
|
238
|
+
</Button>
|
|
239
|
+
</TooltipTrigger>
|
|
240
|
+
<TooltipContent side="bottom" align="center">
|
|
241
|
+
<p>{isRefreshing ? 'Refreshing...' : 'Refresh'}</p>
|
|
242
|
+
</TooltipContent>
|
|
243
|
+
</Tooltip>
|
|
244
|
+
</TooltipProvider>
|
|
245
|
+
</div>
|
|
246
|
+
<p className="text-sm text-muted-foreground dark:text-neutral-400">
|
|
247
|
+
Ship your app to live in seconds with just one prompt.{' '}
|
|
248
|
+
<a
|
|
249
|
+
href="https://docs.insforge.dev/core-concepts/deployments/architecture"
|
|
250
|
+
target="_blank"
|
|
251
|
+
rel="noopener noreferrer"
|
|
252
|
+
className="text-blue-600 dark:text-blue-400 hover:underline"
|
|
253
|
+
>
|
|
254
|
+
Learn more
|
|
255
|
+
</a>
|
|
256
|
+
</p>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
{/* Fixed Table Header */}
|
|
260
|
+
<div className="shrink-0 grid grid-cols-12 px-7 pt-6 pb-2 text-sm text-muted-foreground dark:text-neutral-400">
|
|
261
|
+
<div className="col-span-3 py-1 px-3">ID</div>
|
|
262
|
+
<div className="col-span-2 py-1 px-3">Status</div>
|
|
263
|
+
<div className="col-span-2 py-1 px-3">Provider</div>
|
|
264
|
+
<div className="col-span-3 py-1 px-3">URL</div>
|
|
265
|
+
<div className="col-span-2 py-1 px-3">Created</div>
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
{/* Scrollable Content Area */}
|
|
269
|
+
<div className="flex-1 min-h-0 overflow-auto px-4 pb-4 relative">
|
|
270
|
+
<div className="flex flex-col gap-2">
|
|
271
|
+
{isLoadingDeployments ? (
|
|
272
|
+
<>
|
|
273
|
+
{[...Array(4)].map((_, i) => (
|
|
274
|
+
<Skeleton key={i} className="h-14 rounded-[8px]" />
|
|
275
|
+
))}
|
|
276
|
+
</>
|
|
277
|
+
) : deployments.length > 0 ? (
|
|
278
|
+
<>
|
|
279
|
+
{deployments.map((deployment) => (
|
|
280
|
+
<DeploymentRow
|
|
281
|
+
key={deployment.id}
|
|
282
|
+
deployment={deployment}
|
|
283
|
+
onClick={() => setSelectedDeployment(deployment)}
|
|
284
|
+
/>
|
|
285
|
+
))}
|
|
286
|
+
</>
|
|
287
|
+
) : (
|
|
288
|
+
<DeploymentsEmptyState />
|
|
289
|
+
)}
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
{/* Loading mask overlay */}
|
|
293
|
+
{isRefreshing && (
|
|
294
|
+
<div className="absolute inset-0 bg-white dark:bg-neutral-800 flex items-center justify-center z-50">
|
|
295
|
+
<div className="flex items-center gap-1">
|
|
296
|
+
<div className="w-5 h-5 border-2 border-zinc-500 dark:border-neutral-700 border-t-transparent rounded-full animate-spin" />
|
|
297
|
+
<span className="text-sm text-zinc-500 dark:text-zinc-400">Loading</span>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
)}
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
{/* Pagination */}
|
|
304
|
+
{deployments.length > 0 && (
|
|
305
|
+
<div className="shrink-0">
|
|
306
|
+
<PaginationControls
|
|
307
|
+
currentPage={currentPage}
|
|
308
|
+
totalPages={totalPages}
|
|
309
|
+
onPageChange={handlePageChange}
|
|
310
|
+
totalRecords={totalDeployments}
|
|
311
|
+
pageSize={pageSize}
|
|
312
|
+
recordLabel="deployments"
|
|
313
|
+
/>
|
|
314
|
+
</div>
|
|
315
|
+
)}
|
|
316
|
+
</div>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { apiClient } from '@/lib/api/client';
|
|
2
|
+
import type {
|
|
3
|
+
DeploymentSchema,
|
|
4
|
+
CreateDeploymentResponse,
|
|
5
|
+
StartDeploymentRequest,
|
|
6
|
+
ListDeploymentsResponse,
|
|
7
|
+
} from '@insforge/shared-schemas';
|
|
8
|
+
|
|
9
|
+
export type { DeploymentSchema, CreateDeploymentResponse, ListDeploymentsResponse };
|
|
10
|
+
|
|
11
|
+
export class DeploymentsService {
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Deployments
|
|
14
|
+
// ============================================================================
|
|
15
|
+
|
|
16
|
+
async listDeployments(limit = 50, offset = 0): Promise<ListDeploymentsResponse> {
|
|
17
|
+
const searchParams = new URLSearchParams();
|
|
18
|
+
searchParams.set('limit', String(limit));
|
|
19
|
+
searchParams.set('offset', String(offset));
|
|
20
|
+
|
|
21
|
+
const query = searchParams.toString();
|
|
22
|
+
return apiClient.request(`/deployments?${query}`, {
|
|
23
|
+
headers: apiClient.withAccessToken(),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async getDeployment(id: string): Promise<DeploymentSchema> {
|
|
28
|
+
return apiClient.request(`/deployments/${id}`, {
|
|
29
|
+
headers: apiClient.withAccessToken(),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async createDeployment(): Promise<CreateDeploymentResponse> {
|
|
34
|
+
return apiClient.request('/deployments', {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: apiClient.withAccessToken(),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async startDeployment(id: string, data?: StartDeploymentRequest): Promise<DeploymentSchema> {
|
|
41
|
+
return apiClient.request(`/deployments/${id}/start`, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
headers: apiClient.withAccessToken(),
|
|
44
|
+
body: data ? JSON.stringify(data) : undefined,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async syncDeployment(id: string): Promise<DeploymentSchema> {
|
|
49
|
+
return apiClient.request(`/deployments/${id}/sync`, {
|
|
50
|
+
method: 'POST',
|
|
51
|
+
headers: apiClient.withAccessToken(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async cancelDeployment(id: string): Promise<void> {
|
|
56
|
+
return apiClient.request(`/deployments/${id}/cancel`, {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: apiClient.withAccessToken(),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const deploymentsService = new DeploymentsService();
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { CopyButton } from '@/components/CopyButton';
|
|
2
|
-
import {
|
|
3
|
-
import { cn, getBackendUrl } from '@/lib/utils/utils';
|
|
4
|
-
import { format, formatDistance } from 'date-fns';
|
|
5
|
-
interface FunctionRowProps {
|
|
6
|
-
function:
|
|
7
|
-
onClick: () => void;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function FunctionRow({ function: func, onClick, className }: FunctionRowProps) {
|
|
12
|
-
const functionUrl = `${getBackendUrl()}/functions/${func.slug}`;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<div
|
|
16
|
-
className={cn(
|
|
17
|
-
'group h-14 px-3 bg-white hover:bg-neutral-100 dark:bg-[#333333] dark:hover:bg-neutral-700 rounded-[8px] transition-all cursor-pointer',
|
|
18
|
-
className
|
|
19
|
-
)}
|
|
20
|
-
onClick={onClick}
|
|
21
|
-
>
|
|
22
|
-
<div className="grid grid-cols-12 h-full items-center">
|
|
23
|
-
{/* Name Column */}
|
|
24
|
-
<div className="col-span-2 min-w-0 px-3 py-1.5">
|
|
25
|
-
<p className="text-sm text-zinc-950 dark:text-white truncate" title={func.name}>
|
|
26
|
-
{func.name}
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
{/* URL Column */}
|
|
31
|
-
<div className="col-span-6 min-w-0 px-3 py-1.5">
|
|
32
|
-
<div className="flex items-center gap-3">
|
|
33
|
-
<span
|
|
34
|
-
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
35
|
-
title={functionUrl}
|
|
36
|
-
>
|
|
37
|
-
{functionUrl}
|
|
38
|
-
</span>
|
|
39
|
-
<CopyButton
|
|
40
|
-
variant="secondary"
|
|
41
|
-
showText={false}
|
|
42
|
-
text={functionUrl}
|
|
43
|
-
className="h-7 w-7 dark:hover:bg-neutral-500 dark:data-[copied=true]:group-hover:bg-neutral-700 dark:data-[copied=true]:hover:bg-neutral-700"
|
|
44
|
-
/>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
{/* Created Column */}
|
|
49
|
-
<div className="col-span-2 px-3 py-1.5">
|
|
50
|
-
<span
|
|
51
|
-
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
52
|
-
title={func.
|
|
53
|
-
>
|
|
54
|
-
{format(new Date(func.
|
|
55
|
-
</span>
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
{/* Last Update Column */}
|
|
59
|
-
<div className="col-span-2 px-3 py-1.5">
|
|
60
|
-
<span
|
|
61
|
-
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
62
|
-
title={func.
|
|
63
|
-
>
|
|
64
|
-
{func.
|
|
65
|
-
? formatDistance(new Date(func.
|
|
66
|
-
: 'Never'}
|
|
67
|
-
</span>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
1
|
+
import { CopyButton } from '@/components/CopyButton';
|
|
2
|
+
import { FunctionSchema } from '@insforge/shared-schemas';
|
|
3
|
+
import { cn, getBackendUrl } from '@/lib/utils/utils';
|
|
4
|
+
import { format, formatDistance } from 'date-fns';
|
|
5
|
+
interface FunctionRowProps {
|
|
6
|
+
function: FunctionSchema;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function FunctionRow({ function: func, onClick, className }: FunctionRowProps) {
|
|
12
|
+
const functionUrl = `${getBackendUrl()}/functions/${func.slug}`;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
className={cn(
|
|
17
|
+
'group h-14 px-3 bg-white hover:bg-neutral-100 dark:bg-[#333333] dark:hover:bg-neutral-700 rounded-[8px] transition-all cursor-pointer',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
onClick={onClick}
|
|
21
|
+
>
|
|
22
|
+
<div className="grid grid-cols-12 h-full items-center">
|
|
23
|
+
{/* Name Column */}
|
|
24
|
+
<div className="col-span-2 min-w-0 px-3 py-1.5">
|
|
25
|
+
<p className="text-sm text-zinc-950 dark:text-white truncate" title={func.name}>
|
|
26
|
+
{func.name}
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
{/* URL Column */}
|
|
31
|
+
<div className="col-span-6 min-w-0 px-3 py-1.5">
|
|
32
|
+
<div className="flex items-center gap-3">
|
|
33
|
+
<span
|
|
34
|
+
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
35
|
+
title={functionUrl}
|
|
36
|
+
>
|
|
37
|
+
{functionUrl}
|
|
38
|
+
</span>
|
|
39
|
+
<CopyButton
|
|
40
|
+
variant="secondary"
|
|
41
|
+
showText={false}
|
|
42
|
+
text={functionUrl}
|
|
43
|
+
className="h-7 w-7 dark:hover:bg-neutral-500 dark:data-[copied=true]:group-hover:bg-neutral-700 dark:data-[copied=true]:hover:bg-neutral-700"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
{/* Created Column */}
|
|
49
|
+
<div className="col-span-2 px-3 py-1.5">
|
|
50
|
+
<span
|
|
51
|
+
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
52
|
+
title={func.createdAt}
|
|
53
|
+
>
|
|
54
|
+
{format(new Date(func.createdAt), 'MMM dd, yyyy HH:mm')}
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
{/* Last Update Column */}
|
|
59
|
+
<div className="col-span-2 px-3 py-1.5">
|
|
60
|
+
<span
|
|
61
|
+
className="text-sm text-muted-foreground dark:text-white truncate"
|
|
62
|
+
title={func.deployedAt ?? ''}
|
|
63
|
+
>
|
|
64
|
+
{func.deployedAt
|
|
65
|
+
? formatDistance(new Date(func.deployedAt), new Date(), { addSuffix: true })
|
|
66
|
+
: 'Never'}
|
|
67
|
+
</span>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import { cn } from '@/lib/utils/utils';
|
|
2
|
-
import { useFunctions } from '../hooks/useFunctions';
|
|
3
|
-
|
|
4
|
-
interface FunctionsSidebarProps {
|
|
5
|
-
selectedSection: 'functions' | 'secrets';
|
|
6
|
-
onSectionSelect: (section: 'functions' | 'secrets') => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function FunctionsSidebar({ selectedSection, onSectionSelect }: FunctionsSidebarProps) {
|
|
10
|
-
const { clearSelection } = useFunctions();
|
|
11
|
-
const sections = [
|
|
12
|
-
{
|
|
13
|
-
id: 'functions' as const,
|
|
14
|
-
name: 'Functions',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: 'secrets' as const,
|
|
18
|
-
name: 'Secrets',
|
|
19
|
-
},
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="w-60 px-3 py-4 flex flex-col h-full bg-white dark:bg-neutral-800 border-r border-border-gray dark:border-neutral-700">
|
|
24
|
-
<div className="mb-4 w-full">
|
|
25
|
-
<p className="text-base font-bold text-zinc-950 dark:text-white">Edge Functions</p>
|
|
26
|
-
</div>
|
|
27
|
-
<div className="flex-1 overflow-y-auto">
|
|
28
|
-
<div className="space-y-2">
|
|
29
|
-
{sections.map((section) => {
|
|
30
|
-
const isSelected = selectedSection === section.id;
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<button
|
|
34
|
-
key={section.id}
|
|
35
|
-
onClick={() => {
|
|
36
|
-
if (section.id === 'functions') {
|
|
37
|
-
clearSelection();
|
|
38
|
-
}
|
|
39
|
-
onSectionSelect(section.id);
|
|
40
|
-
}}
|
|
41
|
-
className={cn(
|
|
42
|
-
'h-9 w-full flex items-center justify-between pl-3 py-1 pr-1 rounded text-left transition-colors',
|
|
43
|
-
isSelected
|
|
44
|
-
? 'bg-zinc-100 dark:bg-neutral-700 text-zinc-950 dark:text-white'
|
|
45
|
-
: 'hover:bg-zinc-50 dark:hover:bg-neutral-700/50 text-zinc-700 dark:text-zinc-300'
|
|
46
|
-
)}
|
|
47
|
-
>
|
|
48
|
-
<p className="text-sm text-zinc-950 dark:text-white">{section.name}</p>
|
|
49
|
-
</button>
|
|
50
|
-
);
|
|
51
|
-
})}
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
1
|
+
import { cn } from '@/lib/utils/utils';
|
|
2
|
+
import { useFunctions } from '../hooks/useFunctions';
|
|
3
|
+
|
|
4
|
+
interface FunctionsSidebarProps {
|
|
5
|
+
selectedSection: 'functions' | 'secrets';
|
|
6
|
+
onSectionSelect: (section: 'functions' | 'secrets') => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function FunctionsSidebar({ selectedSection, onSectionSelect }: FunctionsSidebarProps) {
|
|
10
|
+
const { clearSelection } = useFunctions();
|
|
11
|
+
const sections = [
|
|
12
|
+
{
|
|
13
|
+
id: 'functions' as const,
|
|
14
|
+
name: 'Functions',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'secrets' as const,
|
|
18
|
+
name: 'Secrets',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="w-60 px-3 py-4 flex flex-col h-full bg-white dark:bg-neutral-800 border-r border-border-gray dark:border-neutral-700">
|
|
24
|
+
<div className="mb-4 w-full">
|
|
25
|
+
<p className="text-base font-bold text-zinc-950 dark:text-white">Edge Functions</p>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="flex-1 overflow-y-auto">
|
|
28
|
+
<div className="space-y-2">
|
|
29
|
+
{sections.map((section) => {
|
|
30
|
+
const isSelected = selectedSection === section.id;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<button
|
|
34
|
+
key={section.id}
|
|
35
|
+
onClick={() => {
|
|
36
|
+
if (section.id === 'functions') {
|
|
37
|
+
clearSelection();
|
|
38
|
+
}
|
|
39
|
+
onSectionSelect(section.id);
|
|
40
|
+
}}
|
|
41
|
+
className={cn(
|
|
42
|
+
'h-9 w-full flex items-center justify-between pl-3 py-1 pr-1 rounded text-left transition-colors',
|
|
43
|
+
isSelected
|
|
44
|
+
? 'bg-zinc-100 dark:bg-neutral-700 text-zinc-950 dark:text-white'
|
|
45
|
+
: 'hover:bg-zinc-50 dark:hover:bg-neutral-700/50 text-zinc-700 dark:text-zinc-300'
|
|
46
|
+
)}
|
|
47
|
+
>
|
|
48
|
+
<p className="text-sm text-zinc-950 dark:text-white">{section.name}</p>
|
|
49
|
+
</button>
|
|
50
|
+
);
|
|
51
|
+
})}
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Trash2 } from 'lucide-react';
|
|
2
2
|
import { Button } from '@/components/radix/Button';
|
|
3
|
-
import {
|
|
3
|
+
import { SecretSchema } from '@insforge/shared-schemas';
|
|
4
4
|
import { cn } from '@/lib/utils/utils';
|
|
5
5
|
import { formatDistance } from 'date-fns';
|
|
6
6
|
|
|
7
7
|
interface SecretRowProps {
|
|
8
|
-
secret:
|
|
9
|
-
onDelete: (secret:
|
|
8
|
+
secret: SecretSchema;
|
|
9
|
+
onDelete: (secret: SecretSchema) => void;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as FunctionEmptyState } from './FunctionEmptyState';
|
|
2
|
-
export { FunctionRow } from './FunctionRow';
|
|
3
|
-
export { FunctionsSidebar } from './FunctionsSidebar';
|
|
4
|
-
export { default as SecretEmptyState } from './SecretEmptyState';
|
|
5
|
-
export { SecretRow } from './SecretRow';
|
|
1
|
+
export { default as FunctionEmptyState } from './FunctionEmptyState';
|
|
2
|
+
export { FunctionRow } from './FunctionRow';
|
|
3
|
+
export { FunctionsSidebar } from './FunctionsSidebar';
|
|
4
|
+
export { default as SecretEmptyState } from './SecretEmptyState';
|
|
5
|
+
export { SecretRow } from './SecretRow';
|