From 03cc955d204e97e275bc9f393cd361c1d5df6e5a Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Sun, 18 Jan 2026 18:32:55 +0000 Subject: [PATCH] Update data source editor copy --- public/schemas/analytics-dashboard.json | 10 +- public/schemas/file-manager.json | 9 +- src/components/ProjectDashboard.tsx | 5 +- src/components/atoms/DataSourceBadge.tsx | 7 +- .../json-page-renderer/SectionRenderer.tsx | 2 +- src/components/molecules/DataSourceCard.tsx | 25 +- .../molecules/DataSourceEditorDialog.tsx | 22 +- .../ComputedSourceFields.tsx | 128 -------- .../organisms/DataSourceManager.tsx | 13 +- .../DataSourceManagerHeader.tsx | 7 +- .../orchestration/data-source-manager.ts | 9 +- src/config/orchestration/schema.ts | 2 +- src/config/pages/component-tree.json | 280 +++++++++--------- src/config/pages/dashboard.json | 4 - src/config/pages/file-manager.json | 8 +- src/config/pages/flask-designer.json | 31 +- src/config/pages/lambda-designer.json | 164 +++++----- src/config/pages/model-designer.json | 272 ++++++++--------- .../pages/molecules/save-indicator.json | 60 +--- src/config/pages/style-designer.json | 24 +- src/config/pages/workflow-designer.json | 232 ++++++++------- src/data/data-binding-designer.json | 12 +- src/data/data-source-editor-dialog.json | 13 +- src/data/data-source-manager.json | 8 +- src/hooks/data/use-data-source-editor.ts | 39 +-- src/hooks/data/use-data-source-manager.ts | 2 - src/hooks/data/use-data-source.ts | 11 +- src/hooks/data/use-data-sources.ts | 10 +- src/hooks/json-ui/use-data-sources.ts | 10 +- src/hooks/orchestration/use-page.ts | 28 +- src/hooks/use-data-source-editor.ts | 40 +-- src/lib/json-ui/expression-evaluator.ts | 29 ++ src/lib/json-ui/hooks.ts | 3 - src/lib/json-ui/schema.ts | 9 +- .../json-ui/wrappers/SaveIndicatorWrapper.tsx | 17 ++ src/lib/json-ui/wrappers/interfaces.ts | 1 + src/schemas/analytics-dashboard.json | 4 +- src/schemas/todo-list.json | 2 +- src/types/json-ui.ts | 2 +- src/types/page-schema.ts | 2 +- 40 files changed, 653 insertions(+), 903 deletions(-) delete mode 100644 src/components/molecules/data-source-editor/ComputedSourceFields.tsx diff --git a/public/schemas/analytics-dashboard.json b/public/schemas/analytics-dashboard.json index fb69757..0caad8f 100644 --- a/public/schemas/analytics-dashboard.json +++ b/public/schemas/analytics-dashboard.json @@ -39,9 +39,13 @@ }, { "id": "trends", - "type": "computed", - "compute": "(data) => ({ filesGrowth: 12, modelsGrowth: -3, componentsGrowth: 8, testsGrowth: 15 })", - "dependencies": ["metrics"] + "type": "static", + "defaultValue": { + "filesGrowth": 12, + "modelsGrowth": -3, + "componentsGrowth": 8, + "testsGrowth": 15 + } } ], "components": [ diff --git a/public/schemas/file-manager.json b/public/schemas/file-manager.json index 0ceabe6..45ece9c 100644 --- a/public/schemas/file-manager.json +++ b/public/schemas/file-manager.json @@ -25,9 +25,12 @@ }, { "id": "filteredFiles", - "type": "computed", - "compute": "(data) => {\n if (!data.searchQuery) return data.files;\n return data.files.filter(f => f.name.toLowerCase().includes(data.searchQuery.toLowerCase()));\n}", - "dependencies": ["files", "searchQuery"] + "type": "static", + "expression": "data.files", + "dependencies": [ + "files", + "searchQuery" + ] } ], "components": [ diff --git a/src/components/ProjectDashboard.tsx b/src/components/ProjectDashboard.tsx index 3d72c11..2c176cd 100644 --- a/src/components/ProjectDashboard.tsx +++ b/src/components/ProjectDashboard.tsx @@ -45,11 +45,12 @@ function getCompletionMessage(score: number): string { } export function ProjectDashboard(props: ProjectDashboardProps) { + const completionMetrics = calculateCompletionScore(props) + return ( ) } diff --git a/src/components/atoms/DataSourceBadge.tsx b/src/components/atoms/DataSourceBadge.tsx index 8d2b2de..0837490 100644 --- a/src/components/atoms/DataSourceBadge.tsx +++ b/src/components/atoms/DataSourceBadge.tsx @@ -1,6 +1,6 @@ import { Badge } from '@/components/ui/badge' import { DataSourceType } from '@/types/json-ui' -import { Database, Function, File } from '@phosphor-icons/react' +import { Database, File } from '@phosphor-icons/react' interface DataSourceBadgeProps { type: DataSourceType @@ -13,11 +13,6 @@ const dataSourceConfig = { label: 'KV Storage', className: 'bg-accent/20 text-accent border-accent/30' }, - computed: { - icon: Function, - label: 'Computed', - className: 'bg-primary/20 text-primary border-primary/30' - }, static: { icon: File, label: 'Static', diff --git a/src/components/json-page-renderer/SectionRenderer.tsx b/src/components/json-page-renderer/SectionRenderer.tsx index e698c50..ac85f6d 100644 --- a/src/components/json-page-renderer/SectionRenderer.tsx +++ b/src/components/json-page-renderer/SectionRenderer.tsx @@ -108,7 +108,7 @@ function PageCard({ card, data, functions }: PageCardProps) { if (card.type === 'gradient-card') { const computeFn = functions[card.dataSource?.compute] - const computedData = computeFn ? computeFn(data) : {} + const computedData = computeFn ? computeFn(data) : data return ( diff --git a/src/components/molecules/DataSourceCard.tsx b/src/components/molecules/DataSourceCard.tsx index 2387604..8e0d03a 100644 --- a/src/components/molecules/DataSourceCard.tsx +++ b/src/components/molecules/DataSourceCard.tsx @@ -1,7 +1,7 @@ -import { Card, Badge, IconButton, Stack, Flex, Text } from '@/components/atoms' +import { Card, IconButton, Stack, Flex, Text } from '@/components/atoms' import { DataSourceBadge } from '@/components/atoms/DataSourceBadge' import { DataSource } from '@/types/json-ui' -import { Pencil, Trash, ArrowsDownUp } from '@phosphor-icons/react' +import { Pencil, Trash } from '@phosphor-icons/react' interface DataSourceCardProps { dataSource: DataSource @@ -11,13 +11,6 @@ interface DataSourceCardProps { } export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete }: DataSourceCardProps) { - const getDependencyCount = () => { - if (dataSource.type === 'computed') { - return dataSource.dependencies?.length || 0 - } - return 0 - } - const renderTypeSpecificInfo = () => { if (dataSource.type === 'kv') { return ( @@ -27,18 +20,6 @@ export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete } ) } - if (dataSource.type === 'computed') { - const depCount = getDependencyCount() - return ( - - - - {depCount} {depCount === 1 ? 'dependency' : 'dependencies'} - - - ) - } - return null } @@ -59,7 +40,7 @@ export function DataSourceCard({ dataSource, dependents = [], onEdit, onDelete } {dependents.length > 0 && (
- Used by {dependents.length} computed {dependents.length === 1 ? 'source' : 'sources'} + Used by {dependents.length} dependent {dependents.length === 1 ? 'source' : 'sources'}
)} diff --git a/src/components/molecules/DataSourceEditorDialog.tsx b/src/components/molecules/DataSourceEditorDialog.tsx index 20de4ae..1fa2ced 100644 --- a/src/components/molecules/DataSourceEditorDialog.tsx +++ b/src/components/molecules/DataSourceEditorDialog.tsx @@ -5,14 +5,12 @@ import { DataSourceBadge } from '@/components/atoms/DataSourceBadge' import { DataSourceIdField } from '@/components/molecules/data-source-editor/DataSourceIdField' import { KvSourceFields } from '@/components/molecules/data-source-editor/KvSourceFields' import { StaticSourceFields } from '@/components/molecules/data-source-editor/StaticSourceFields' -import { ComputedSourceFields } from '@/components/molecules/data-source-editor/ComputedSourceFields' import dataSourceEditorCopy from '@/data/data-source-editor-dialog.json' import { useDataSourceEditor } from '@/hooks/data/use-data-source-editor' interface DataSourceEditorDialogProps { open: boolean dataSource: DataSource | null - allDataSources: DataSource[] onOpenChange: (open: boolean) => void onSave: (dataSource: DataSource) => void } @@ -20,19 +18,13 @@ interface DataSourceEditorDialogProps { export function DataSourceEditorDialog({ open, dataSource, - allDataSources, onOpenChange, onSave, }: DataSourceEditorDialogProps) { const { editingSource, updateField, - addDependency, - removeDependency, - availableDeps, - selectedDeps, - unselectedDeps, - } = useDataSourceEditor(dataSource, allDataSources) + } = useDataSourceEditor(dataSource) const handleSave = () => { if (!editingSource) return @@ -80,18 +72,6 @@ export function DataSourceEditorDialog({ /> )} - {editingSource.type === 'computed' && ( - - )} diff --git a/src/components/molecules/data-source-editor/ComputedSourceFields.tsx b/src/components/molecules/data-source-editor/ComputedSourceFields.tsx deleted file mode 100644 index fa70389..0000000 --- a/src/components/molecules/data-source-editor/ComputedSourceFields.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { Button } from '@/components/ui/button' -import { Label } from '@/components/ui/label' -import { Textarea } from '@/components/ui/textarea' -import { Badge } from '@/components/ui/badge' -import { DataSource } from '@/types/json-ui' -import { X } from '@phosphor-icons/react' - -interface ComputedSourceFieldsCopy { - expressionLabel: string - expressionPlaceholder: string - expressionHelp: string - valueTemplateLabel: string - valueTemplatePlaceholder: string - valueTemplateHelp: string - dependenciesLabel: string - availableSourcesLabel: string - emptyDependencies: string -} - -interface ComputedSourceFieldsProps { - editingSource: DataSource - availableDeps: DataSource[] - selectedDeps: string[] - unselectedDeps: DataSource[] - copy: ComputedSourceFieldsCopy - onUpdateField: (field: K, value: DataSource[K]) => void - onAddDependency: (depId: string) => void - onRemoveDependency: (depId: string) => void -} - -export function ComputedSourceFields({ - editingSource, - availableDeps, - selectedDeps, - unselectedDeps, - copy, - onUpdateField, - onAddDependency, - onRemoveDependency, -}: ComputedSourceFieldsProps) { - return ( - <> -
- -