@surfaces-ui/components 0.0.0-stage → 0.3.0
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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +51 -2
- package/dist/appComponents.d.ts +86 -0
- package/dist/appComponents.js +555 -0
- package/dist/appComponents.js.map +1 -0
- package/dist/chart/BulletGraph.d.ts +44 -0
- package/dist/chart/BulletGraph.js +41 -0
- package/dist/chart/BulletGraph.js.map +1 -0
- package/dist/chart/Chart.d.ts +178 -0
- package/dist/chart/Chart.js +285 -0
- package/dist/chart/Chart.js.map +1 -0
- package/dist/chart/Sparkline.d.ts +35 -0
- package/dist/chart/Sparkline.js +38 -0
- package/dist/chart/Sparkline.js.map +1 -0
- package/dist/chart/advice.d.ts +32 -0
- package/dist/chart/advice.js +48 -0
- package/dist/chart/advice.js.map +1 -0
- package/dist/chart/option.d.ts +90 -0
- package/dist/chart/option.js +252 -0
- package/dist/chart/option.js.map +1 -0
- package/dist/chart/wheel.d.ts +12 -0
- package/dist/chart/wheel.js +21 -0
- package/dist/chart/wheel.js.map +1 -0
- package/dist/controls/Combobox.d.ts +39 -0
- package/dist/controls/Combobox.js +75 -0
- package/dist/controls/Combobox.js.map +1 -0
- package/dist/controls/ConfirmDialog.d.ts +35 -0
- package/dist/controls/ConfirmDialog.js +84 -0
- package/dist/controls/ConfirmDialog.js.map +1 -0
- package/dist/controls/ItemControls.d.ts +115 -0
- package/dist/controls/ItemControls.js +109 -0
- package/dist/controls/ItemControls.js.map +1 -0
- package/dist/controls/Popover.d.ts +31 -0
- package/dist/controls/Popover.js +114 -0
- package/dist/controls/Popover.js.map +1 -0
- package/dist/controls/ResizeHandle.d.ts +48 -0
- package/dist/controls/ResizeHandle.js +91 -0
- package/dist/controls/ResizeHandle.js.map +1 -0
- package/dist/controls/SegmentedControl.d.ts +27 -0
- package/dist/controls/SegmentedControl.js +17 -0
- package/dist/controls/SegmentedControl.js.map +1 -0
- package/dist/controls/StatusBadge.d.ts +17 -0
- package/dist/controls/StatusBadge.js +10 -0
- package/dist/controls/StatusBadge.js.map +1 -0
- package/dist/controls/context.d.ts +17 -0
- package/dist/controls/context.js +2 -0
- package/dist/controls/context.js.map +1 -0
- package/dist/controls/placement.d.ts +43 -0
- package/dist/controls/placement.js +19 -0
- package/dist/controls/placement.js.map +1 -0
- package/dist/controls/resize.d.ts +23 -0
- package/dist/controls/resize.js +49 -0
- package/dist/controls/resize.js.map +1 -0
- package/dist/data/DataNotes.d.ts +13 -0
- package/dist/data/DataNotes.js +18 -0
- package/dist/data/DataNotes.js.map +1 -0
- package/dist/data/DataSourceProvider.d.ts +11 -0
- package/dist/data/DataSourceProvider.js +21 -0
- package/dist/data/DataSourceProvider.js.map +1 -0
- package/dist/data/export.d.ts +33 -0
- package/dist/data/export.js +77 -0
- package/dist/data/export.js.map +1 -0
- package/dist/data/format.d.ts +44 -0
- package/dist/data/format.js +127 -0
- package/dist/data/format.js.map +1 -0
- package/dist/data/messages.d.ts +13 -0
- package/dist/data/messages.js +2 -0
- package/dist/data/messages.js.map +1 -0
- package/dist/data/useRowWindow.d.ts +70 -0
- package/dist/data/useRowWindow.js +175 -0
- package/dist/data/useRowWindow.js.map +1 -0
- package/dist/discovery/AskData.d.ts +22 -0
- package/dist/discovery/AskData.js +49 -0
- package/dist/discovery/AskData.js.map +1 -0
- package/dist/discovery/ContextBuilder.d.ts +49 -0
- package/dist/discovery/ContextBuilder.js +167 -0
- package/dist/discovery/ContextBuilder.js.map +1 -0
- package/dist/discovery/DataSearch.d.ts +27 -0
- package/dist/discovery/DataSearch.js +73 -0
- package/dist/discovery/DataSearch.js.map +1 -0
- package/dist/discovery/ObjectDetail.d.ts +38 -0
- package/dist/discovery/ObjectDetail.js +129 -0
- package/dist/discovery/ObjectDetail.js.map +1 -0
- package/dist/discovery/RelationshipGraph.d.ts +19 -0
- package/dist/discovery/RelationshipGraph.js +64 -0
- package/dist/discovery/RelationshipGraph.js.map +1 -0
- package/dist/discovery/shared.d.ts +38 -0
- package/dist/discovery/shared.js +64 -0
- package/dist/discovery/shared.js.map +1 -0
- package/dist/editor/SqlEditor.d.ts +41 -0
- package/dist/editor/SqlEditor.js +181 -0
- package/dist/editor/SqlEditor.js.map +1 -0
- package/dist/explore/Explorer.d.ts +110 -0
- package/dist/explore/Explorer.js +471 -0
- package/dist/explore/Explorer.js.map +1 -0
- package/dist/explore/ModelLineage.d.ts +22 -0
- package/dist/explore/ModelLineage.js +70 -0
- package/dist/explore/ModelLineage.js.map +1 -0
- package/dist/explore/ReportBuilder.d.ts +39 -0
- package/dist/explore/ReportBuilder.js +98 -0
- package/dist/explore/ReportBuilder.js.map +1 -0
- package/dist/explore/SemanticModelEditor.d.ts +60 -0
- package/dist/explore/SemanticModelEditor.js +220 -0
- package/dist/explore/SemanticModelEditor.js.map +1 -0
- package/dist/explore/SemanticRows.d.ts +42 -0
- package/dist/explore/SemanticRows.js +121 -0
- package/dist/explore/SemanticRows.js.map +1 -0
- package/dist/explore/SemanticsProvider.d.ts +31 -0
- package/dist/explore/SemanticsProvider.js +72 -0
- package/dist/explore/SemanticsProvider.js.map +1 -0
- package/dist/explore/model.d.ts +151 -0
- package/dist/explore/model.js +344 -0
- package/dist/explore/model.js.map +1 -0
- package/dist/explore/report.d.ts +60 -0
- package/dist/explore/report.js +92 -0
- package/dist/explore/report.js.map +1 -0
- package/dist/explore/semantic-proposal.d.ts +44 -0
- package/dist/explore/semantic-proposal.js +67 -0
- package/dist/explore/semantic-proposal.js.map +1 -0
- package/dist/explore/semantic.d.ts +44 -0
- package/dist/explore/semantic.js +154 -0
- package/dist/explore/semantic.js.map +1 -0
- package/dist/files/FileBrowser.d.ts +42 -0
- package/dist/files/FileBrowser.js +314 -0
- package/dist/files/FileBrowser.js.map +1 -0
- package/dist/files/files.d.ts +65 -0
- package/dist/files/files.js +165 -0
- package/dist/files/files.js.map +1 -0
- package/dist/filter/FilterBar.d.ts +49 -0
- package/dist/filter/FilterBar.js +153 -0
- package/dist/filter/FilterBar.js.map +1 -0
- package/dist/filter/QueryFilters.d.ts +25 -0
- package/dist/filter/QueryFilters.js +58 -0
- package/dist/filter/QueryFilters.js.map +1 -0
- package/dist/form/Form.d.ts +76 -0
- package/dist/form/Form.js +131 -0
- package/dist/form/Form.js.map +1 -0
- package/dist/graph/NodeGraph.d.ts +30 -0
- package/dist/graph/NodeGraph.js +89 -0
- package/dist/graph/NodeGraph.js.map +1 -0
- package/dist/graph/model.d.ts +68 -0
- package/dist/graph/model.js +122 -0
- package/dist/graph/model.js.map +1 -0
- package/dist/grid/DataGrid.d.ts +98 -0
- package/dist/grid/DataGrid.js +400 -0
- package/dist/grid/DataGrid.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/locale/SurfacesText.d.ts +17 -0
- package/dist/locale/SurfacesText.js +17 -0
- package/dist/locale/SurfacesText.js.map +1 -0
- package/dist/locale/locale.d.ts +305 -0
- package/dist/locale/locale.js +359 -0
- package/dist/locale/locale.js.map +1 -0
- package/dist/menu/ContextMenu.d.ts +31 -0
- package/dist/menu/ContextMenu.js +95 -0
- package/dist/menu/ContextMenu.js.map +1 -0
- package/dist/metric/Metric.d.ts +33 -0
- package/dist/metric/Metric.js +64 -0
- package/dist/metric/Metric.js.map +1 -0
- package/dist/metric/useMeasure.d.ts +25 -0
- package/dist/metric/useMeasure.js +44 -0
- package/dist/metric/useMeasure.js.map +1 -0
- package/dist/model/ModelDiagram.d.ts +142 -0
- package/dist/model/ModelDiagram.js +700 -0
- package/dist/model/ModelDiagram.js.map +1 -0
- package/dist/panzoom/usePanZoom.d.ts +117 -0
- package/dist/panzoom/usePanZoom.js +313 -0
- package/dist/panzoom/usePanZoom.js.map +1 -0
- package/dist/pipeline/DatasetReview.d.ts +48 -0
- package/dist/pipeline/DatasetReview.js +157 -0
- package/dist/pipeline/DatasetReview.js.map +1 -0
- package/dist/pipeline/IngestWizard.d.ts +51 -0
- package/dist/pipeline/IngestWizard.js +79 -0
- package/dist/pipeline/IngestWizard.js.map +1 -0
- package/dist/pipeline/Pipeline.d.ts +171 -0
- package/dist/pipeline/Pipeline.js +203 -0
- package/dist/pipeline/Pipeline.js.map +1 -0
- package/dist/pipeline/PipelineView.d.ts +63 -0
- package/dist/pipeline/PipelineView.js +239 -0
- package/dist/pipeline/PipelineView.js.map +1 -0
- package/dist/pivot/PivotTable.d.ts +94 -0
- package/dist/pivot/PivotTable.js +176 -0
- package/dist/pivot/PivotTable.js.map +1 -0
- package/dist/plan/QueryPlan.d.ts +29 -0
- package/dist/plan/QueryPlan.js +79 -0
- package/dist/plan/QueryPlan.js.map +1 -0
- package/dist/result/QueryResult.d.ts +51 -0
- package/dist/result/QueryResult.js +256 -0
- package/dist/result/QueryResult.js.map +1 -0
- package/dist/review/ActionReceipt.d.ts +52 -0
- package/dist/review/ActionReceipt.js +32 -0
- package/dist/review/ActionReceipt.js.map +1 -0
- package/dist/review/PiiReview.d.ts +37 -0
- package/dist/review/PiiReview.js +29 -0
- package/dist/review/PiiReview.js.map +1 -0
- package/dist/review/PlanReview.d.ts +42 -0
- package/dist/review/PlanReview.js +37 -0
- package/dist/review/PlanReview.js.map +1 -0
- package/dist/review/StepFlow.d.ts +25 -0
- package/dist/review/StepFlow.js +21 -0
- package/dist/review/StepFlow.js.map +1 -0
- package/dist/review/pii.d.ts +21 -0
- package/dist/review/pii.js +67 -0
- package/dist/review/pii.js.map +1 -0
- package/dist/rows/RowList.d.ts +41 -0
- package/dist/rows/RowList.js +72 -0
- package/dist/rows/RowList.js.map +1 -0
- package/dist/schema/ObjectBrowser.d.ts +78 -0
- package/dist/schema/ObjectBrowser.js +467 -0
- package/dist/schema/ObjectBrowser.js.map +1 -0
- package/dist/schema/ObjectInfo.d.ts +25 -0
- package/dist/schema/ObjectInfo.js +69 -0
- package/dist/schema/ObjectInfo.js.map +1 -0
- package/dist/schema/SchemaExplorer.d.ts +32 -0
- package/dist/schema/SchemaExplorer.js +175 -0
- package/dist/schema/SchemaExplorer.js.map +1 -0
- package/dist/schema/refs.d.ts +32 -0
- package/dist/schema/refs.js +65 -0
- package/dist/schema/refs.js.map +1 -0
- package/dist/site/Site.d.ts +191 -0
- package/dist/site/Site.js +138 -0
- package/dist/site/Site.js.map +1 -0
- package/dist/source/ConnectionBuilder.d.ts +54 -0
- package/dist/source/ConnectionBuilder.js +115 -0
- package/dist/source/ConnectionBuilder.js.map +1 -0
- package/dist/source/SourceList.d.ts +17 -0
- package/dist/source/SourceList.js +71 -0
- package/dist/source/SourceList.js.map +1 -0
- package/dist/styles.css +9930 -0
- package/dist/styles.layer.css +9934 -0
- package/dist/table/DataTable.d.ts +72 -0
- package/dist/table/DataTable.js +68 -0
- package/dist/table/DataTable.js.map +1 -0
- package/dist/table/Pagination.d.ts +20 -0
- package/dist/table/Pagination.js +16 -0
- package/dist/table/Pagination.js.map +1 -0
- package/dist/table/SelectionBar.d.ts +43 -0
- package/dist/table/SelectionBar.js +18 -0
- package/dist/table/SelectionBar.js.map +1 -0
- package/dist/text/Markdown.d.ts +71 -0
- package/dist/text/Markdown.js +187 -0
- package/dist/text/Markdown.js.map +1 -0
- package/dist/text/highlight.d.ts +23 -0
- package/dist/text/highlight.js +196 -0
- package/dist/text/highlight.js.map +1 -0
- package/dist/theme/ThemePicker.d.ts +16 -0
- package/dist/theme/ThemePicker.js +50 -0
- package/dist/theme/ThemePicker.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +52 -0
- package/dist/theme/ThemeProvider.js +111 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/workspace/NavBar.d.ts +23 -0
- package/dist/workspace/NavBar.js +171 -0
- package/dist/workspace/NavBar.js.map +1 -0
- package/dist/workspace/SideNav.d.ts +61 -0
- package/dist/workspace/SideNav.js +149 -0
- package/dist/workspace/SideNav.js.map +1 -0
- package/dist/workspace/Workspace.d.ts +53 -0
- package/dist/workspace/Workspace.js +243 -0
- package/dist/workspace/Workspace.js.map +1 -0
- package/dist/workspace/icons.d.ts +34 -0
- package/dist/workspace/icons.js +37 -0
- package/dist/workspace/icons.js.map +1 -0
- package/dist/workspace/layout.d.ts +74 -0
- package/dist/workspace/layout.js +276 -0
- package/dist/workspace/layout.js.map +1 -0
- package/package.json +85 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionBuilder.js","sourceRoot":"","sources":["../../src/source/ConnectionBuilder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA+BhD,MAAM,CAAC,MAAM,oBAAoB,GAAoB;IACnD,QAAQ,EAAE,MAAM;IAChB,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,EAAE;IACT,WAAW,EAAE,QAAQ;IACrB,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACnD,UAAU,EAAE,EAAE;IACd,gBAAgB,EAAE,EAAE;CACrB,CAAC;AAEF,MAAM,OAAO,GAA0E;IACrF,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE;IAChG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE;IAC9F,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE;IACpF,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE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AgB,CACjC,CAAC,GACC,CACN,CAAC,CAAC,CAAC,CACF,8BACE,YAAG,SAAS,EAAC,iBAAiB,6DAAiD,EAC/E,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAC,IAAI,GAAG,EAC7C,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CACtB,8BACE,YAAG,SAAS,EAAC,iBAAiB,4DAAgD,EAC9E,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAC,IAAI,GAAG,IACvF,CACJ,EACD,YAAG,SAAS,EAAC,iBAAiB,0GAAoF,IACjH,CACJ,GACO,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useId, useState } from \"react\";\nimport { CodeBlock } from \"../text/Markdown.js\";\n\nexport type StorageKind = \"local\" | \"s3\" | \"gcs\" | \"azure\" | \"http\";\nexport type TableFormatName = \"parquet\" | \"delta\" | \"iceberg\" | \"csv\" | \"json\";\nexport type CredentialMode = \"secret\" | \"ambient\" | \"public\";\n\nexport interface ConnectionDraftTable {\n name: string;\n format: TableFormatName;\n /** A file, glob or table root. For Iceberg, the table root or a metadata.json file. */\n path: string;\n}\n\n/** A source being set up. It holds the name of a secret, never a credential. */\nexport interface ConnectionDraft {\n sourceId: string;\n storage: StorageKind;\n /** Bucket or prefix the connection covers, e.g. s3://acme-lake/sales. Not used for local files. */\n scope: string;\n credentials: CredentialMode;\n /** Name of the server-side secret, e.g. LAKE. */\n secret: string;\n region: string;\n /** For S3-compatible stores such as MinIO. */\n endpoint: string;\n tables: ConnectionDraftTable[];\n /** Optional Iceberg REST catalog to attach. */\n catalogUri: string;\n catalogWarehouse: string;\n}\n\nexport const emptyConnectionDraft: ConnectionDraft = {\n sourceId: \"lake\",\n storage: \"s3\",\n scope: \"\",\n credentials: \"secret\",\n secret: \"LAKE\",\n region: \"\",\n endpoint: \"\",\n tables: [{ name: \"\", format: \"parquet\", path: \"\" }],\n catalogUri: \"\",\n catalogWarehouse: \"\",\n};\n\nconst STORAGE: { id: StorageKind; label: string; prefix: string; example: string }[] = [\n { id: \"s3\", label: \"Amazon S3 or compatible\", prefix: \"s3://\", example: \"s3://acme-lake/sales\" },\n { id: \"gcs\", label: \"Google Cloud Storage\", prefix: \"gs://\", example: \"gs://acme-lake/sales\" },\n { id: \"azure\", label: \"Azure Storage\", prefix: \"az://\", example: \"az://lake/sales\" },\n { id: \"http\", label: \"Web (https)\", prefix: \"https://\", example: \"https://data.example.com/lake\" },\n { id: \"local\", label: \"Files on the server\", prefix: \"\", example: \"data/orders.parquet\" },\n];\nconst FORMATS: { id: TableFormatName; label: string; hint: string }[] = [\n { id: \"parquet\", label: \"Parquet\", hint: \"A file or a glob such as orders/*.parquet\" },\n { id: \"delta\", label: \"Delta Lake\", hint: \"The table's root folder (the one holding _delta_log)\" },\n { id: \"iceberg\", label: \"Iceberg\", hint: \"The table's root folder, or its metadata.json file\" },\n { id: \"csv\", label: \"CSV\", hint: \"A file or a glob\" },\n { id: \"json\", label: \"JSON\", hint: \"A file or a glob\" },\n];\n\nconst ENV_FIELDS: Record<Exclude<StorageKind, \"local\">, string[]> = {\n s3: [\"KEY_ID\", \"SECRET\"],\n gcs: [\"KEY_ID\", \"SECRET\"],\n azure: [\"CONNECTION_STRING\"],\n http: [\"TOKEN\"],\n};\n\nexport interface ConnectionPlan {\n /** A `surfaces.config.ts` source entry. Contains secret names only. */\n config: string;\n /** Environment variables to set on the server before starting it. */\n env: string[];\n /** What must be fixed before the config will work. */\n problems: string[];\n}\n\nconst quote = (value: string) => JSON.stringify(value);\n\n/**\n * Turns a draft into the config a server reads and the environment\n * variables that carry its credentials. Pure, so it can be tested and reused\n * by an agent or a command-line tool.\n */\nexport function connectionPlan(draft: ConnectionDraft): ConnectionPlan {\n const problems: string[] = [];\n const remote = draft.storage !== \"local\";\n const storage = STORAGE.find((s) => s.id === draft.storage)!;\n const scope = draft.scope.trim().replace(/\\/+$/, \"\");\n const secret = draft.secret.trim();\n if (!/^[A-Za-z_][\\w-]*$/.test(draft.sourceId)) problems.push(\"Give the source a short name made of letters, digits, hyphens or underscores.\");\n if (remote && !scope.startsWith(storage.prefix)) problems.push(`The location should start with ${storage.prefix}`);\n if (remote && draft.credentials === \"secret\" && !/^[A-Z][A-Z0-9_]*$/.test(secret)) problems.push(\"Name the secret in capitals, e.g. LAKE. Its values are set on the server, not here.\");\n const tables = draft.tables.filter((t) => t.name.trim() || t.path.trim());\n if (tables.length === 0 && !draft.catalogUri.trim()) problems.push(\"Add at least one table or a catalog.\");\n for (const table of tables) {\n if (!/^[A-Za-z_]\\w*$/.test(table.name.trim())) problems.push(`Table names use letters, digits and underscores: ${table.name || \"(empty)\"}`);\n if (remote && scope && !table.path.trim().startsWith(scope)) problems.push(`${table.name || \"A table\"} is outside ${scope}, so the connection will not cover it.`);\n if (!table.path.trim()) problems.push(`${table.name || \"A table\"} needs a location.`);\n }\n if (new Set(tables.map((t) => t.name.trim().toLowerCase())).size !== tables.length) problems.push(\"Two tables have the same name.\");\n\n const lines = [\"{\", ` id: ${quote(draft.sourceId)},`, ` engine: \"duckdb\",`];\n if (remote) {\n const connection = [`name: ${quote(draft.sourceId.replace(/-/g, \"_\"))}`, `kind: ${quote(draft.storage)}`, `scope: ${quote(scope)}`];\n if (draft.credentials === \"secret\") connection.push(`secret: ${quote(secret)}`);\n if (draft.credentials === \"ambient\") connection.push(\"ambientCredentials: true\");\n if (draft.region.trim()) connection.push(`region: ${quote(draft.region.trim())}`);\n if (draft.endpoint.trim()) connection.push(`endpoint: ${quote(draft.endpoint.trim())}`, `urlStyle: \"path\"`);\n lines.push(` connections: [{ ${connection.join(\", \")} }],`);\n }\n lines.push(\" tables: [\");\n for (const table of tables) lines.push(` { name: ${quote(table.name.trim())}, format: ${quote(table.format)}, path: ${quote(table.path.trim())} },`);\n lines.push(\" ],\");\n if (draft.catalogUri.trim()) {\n const catalog = [`name: \"catalog\"`, `kind: \"iceberg-rest\"`, `uri: ${quote(draft.catalogUri.trim())}`];\n if (draft.catalogWarehouse.trim()) catalog.push(`warehouse: ${quote(draft.catalogWarehouse.trim())}`);\n if (draft.credentials === \"secret\") catalog.push(`secret: ${quote(secret)}`);\n lines.push(` catalogs: [{ ${catalog.join(\", \")} }],`);\n }\n lines.push(\"}\");\n\n const env =\n remote && draft.credentials === \"secret\"\n ? [...ENV_FIELDS[draft.storage as Exclude<StorageKind, \"local\">], ...(draft.catalogUri.trim() ? [\"TOKEN\"] : [])].filter((f, i, all) => all.indexOf(f) === i).map((field) => `${secret}_${field}`)\n : [];\n return { config: lines.join(\"\\n\"), env, problems };\n}\n\nexport interface ConnectionBuilderProps {\n value: ConnectionDraft;\n onChange(draft: ConnectionDraft): void;\n className?: string;\n}\n\n/**\n * Sets up a connection to Parquet, Delta Lake or Iceberg data on an object\n * store, a web server or the server's own disk, and optionally an Iceberg\n * REST catalog. It writes the config for the server and lists the\n * environment variables that hold the credentials. There is nowhere to type\n * a credential: the browser only ever handles the secret's name.\n */\nexport function ConnectionBuilder({ value, onChange, className }: ConnectionBuilderProps) {\n const id = useId();\n const plan = connectionPlan(value);\n const storage = STORAGE.find((s) => s.id === value.storage)!;\n const remote = value.storage !== \"local\";\n const set = (change: Partial<ConnectionDraft>) => onChange({ ...value, ...change });\n const setTable = (index: number, change: Partial<ConnectionDraftTable>) => set({ tables: value.tables.map((t, i) => (i === index ? { ...t, ...change } : t)) });\n const field = (label: string, key: keyof ConnectionDraft, placeholder = \"\") => (\n <label>\n <span>{label}</span>\n <input className=\"sf-input\" value={String(value[key])} placeholder={placeholder} onChange={(e) => set({ [key]: e.target.value } as Partial<ConnectionDraft>)} />\n </label>\n );\n\n return (\n <div className={[\"sf-connect\", className].filter(Boolean).join(\" \")}>\n <fieldset className=\"sf-connect-group\">\n <legend>Where the data is</legend>\n {field(\"Source name\", \"sourceId\", \"lake\")}\n <label>\n <span>Storage</span>\n <select className=\"sf-input\" value={value.storage} onChange={(e) => set({ storage: e.target.value as StorageKind, scope: \"\" })}>\n {STORAGE.map((s) => (\n <option key={s.id} value={s.id}>\n {s.label}\n </option>\n ))}\n </select>\n </label>\n {remote && field(\"Bucket or folder it covers\", \"scope\", storage.example)}\n {(value.storage === \"s3\" || value.storage === \"gcs\") && field(\"Region\", \"region\", \"us-east-1\")}\n {value.storage === \"s3\" && field(\"Endpoint (S3-compatible stores only)\", \"endpoint\", \"minio.internal:9000\")}\n </fieldset>\n\n {remote && (\n <fieldset className=\"sf-connect-group\">\n <legend>How the server signs in</legend>\n <label>\n <span>Credentials</span>\n <select className=\"sf-input\" value={value.credentials} onChange={(e) => set({ credentials: e.target.value as CredentialMode })}>\n <option value=\"secret\">A named secret on the server</option>\n {value.storage !== \"http\" && <option value=\"ambient\">The server's own cloud role or profile</option>}\n <option value=\"public\">None, the data is public</option>\n </select>\n </label>\n {value.credentials === \"secret\" && field(\"Secret name\", \"secret\", \"LAKE\")}\n <p className=\"sf-connect-note\">Credentials are never typed here. The server reads them from its environment by this name.</p>\n </fieldset>\n )}\n\n <fieldset className=\"sf-connect-group sf-connect-tables\">\n <legend>Tables</legend>\n {value.tables.map((table, index) => (\n <div key={index} className=\"sf-connect-row\" role=\"group\" aria-label={`Table ${index + 1}`}>\n <label>\n <span>Name</span>\n <input className=\"sf-input\" value={table.name} placeholder=\"orders\" onChange={(e) => setTable(index, { name: e.target.value })} />\n </label>\n <label>\n <span>Format</span>\n <select className=\"sf-input\" value={table.format} onChange={(e) => setTable(index, { format: e.target.value as TableFormatName })}>\n {FORMATS.map((f) => (\n <option key={f.id} value={f.id}>\n {f.label}\n </option>\n ))}\n </select>\n </label>\n <div className=\"sf-connect-path\">\n <label>\n <span>Location</span>\n <input\n className=\"sf-input\"\n value={table.path}\n placeholder={remote ? `${value.scope || storage.example}/orders` : storage.example}\n aria-describedby={`${id}-hint-${index}`}\n onChange={(e) => setTable(index, { path: e.target.value })}\n />\n </label>\n <span id={`${id}-hint-${index}`} className=\"sf-connect-note\">\n {FORMATS.find((f) => f.id === table.format)!.hint}\n </span>\n </div>\n {value.tables.length > 1 && (\n <button type=\"button\" className=\"sf-button\" aria-label={`Remove table ${index + 1}`} onClick={() => set({ tables: value.tables.filter((_, i) => i !== index) })}>\n Remove\n </button>\n )}\n </div>\n ))}\n <button type=\"button\" className=\"sf-button\" onClick={() => set({ tables: [...value.tables, { name: \"\", format: \"parquet\", path: \"\" }] })}>\n Add table\n </button>\n </fieldset>\n\n {remote && (\n <fieldset className=\"sf-connect-group\">\n <legend>Iceberg catalog (optional)</legend>\n {field(\"REST catalog address\", \"catalogUri\", \"https://catalog.example.com/api/catalog\")}\n {field(\"Warehouse\", \"catalogWarehouse\", \"analytics\")}\n <p className=\"sf-connect-note\">Every table in the catalog is listed under its own schema, so they need not be added one by one.</p>\n </fieldset>\n )}\n\n <section className=\"sf-connect-plan\" aria-label=\"What to do\" aria-live=\"polite\">\n {plan.problems.length > 0 ? (\n <ul className=\"sf-connect-problems\">\n {plan.problems.map((problem) => (\n <li key={problem}>{problem}</li>\n ))}\n </ul>\n ) : (\n <>\n <p className=\"sf-object-label\">1. Add this to sources in surfaces.config.ts</p>\n <CodeBlock code={plan.config} language=\"ts\" />\n {plan.env.length > 0 && (\n <>\n <p className=\"sf-object-label\">2. Set these on the server, then restart it</p>\n <CodeBlock code={plan.env.map((name) => `export ${name}=…`).join(\"\\n\")} language=\"sh\" />\n </>\n )}\n <p className=\"sf-connect-note\">Then use “Test connection” on the source to see that each table can be reached.</p>\n </>\n )}\n </section>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DataSource } from "@surfaces-ui/data";
|
|
2
|
+
import { type Connection, ConnectionKind, type Source } from "@surfaces-ui/proto";
|
|
3
|
+
export interface SourceListProps {
|
|
4
|
+
/** Called when a source is chosen. */
|
|
5
|
+
onSelect?(source: Source): void;
|
|
6
|
+
dataSource?: DataSource;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const CONNECTION_LABEL: Partial<Record<ConnectionKind, string>>;
|
|
10
|
+
/** How a connection signs in, in words. Only the secret's name is ever known here. */
|
|
11
|
+
export declare function credentialText(connection: Connection): string;
|
|
12
|
+
/**
|
|
13
|
+
* The data sources a backend offers: what runs their SQL, how they reach
|
|
14
|
+
* storage and catalogs, and whether each table can be reached right now.
|
|
15
|
+
* Credentials are shown by name only; their values never leave the server.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SourceList(props: SourceListProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ConnectionKind, Engine } from "@surfaces-ui/proto";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useDataSource } from "../data/DataSourceProvider.js";
|
|
5
|
+
import { messageOf } from "../data/useRowWindow.js";
|
|
6
|
+
const ENGINE_LABEL = {
|
|
7
|
+
[Engine.DUCKDB]: "DuckDB",
|
|
8
|
+
[Engine.DATAFUSION]: "DataFusion",
|
|
9
|
+
[Engine.TERADATA]: "Teradata",
|
|
10
|
+
[Engine.POSTGRES]: "Postgres",
|
|
11
|
+
};
|
|
12
|
+
export const CONNECTION_LABEL = {
|
|
13
|
+
[ConnectionKind.S3]: "Amazon S3",
|
|
14
|
+
[ConnectionKind.GCS]: "Google Cloud Storage",
|
|
15
|
+
[ConnectionKind.AZURE]: "Azure Storage",
|
|
16
|
+
[ConnectionKind.HTTP]: "Web (https)",
|
|
17
|
+
[ConnectionKind.ICEBERG_REST]: "Iceberg REST catalog",
|
|
18
|
+
[ConnectionKind.DATABASE_FILE]: "Database file",
|
|
19
|
+
[ConnectionKind.POSTGRES]: "Postgres database",
|
|
20
|
+
};
|
|
21
|
+
/** How a connection signs in, in words. Only the secret's name is ever known here. */
|
|
22
|
+
export function credentialText(connection) {
|
|
23
|
+
if (connection.ambientCredentials)
|
|
24
|
+
return "The server's own cloud credentials";
|
|
25
|
+
return connection.credentialsSecret ? `Secret ${connection.credentialsSecret}` : "None (public)";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The data sources a backend offers: what runs their SQL, how they reach
|
|
29
|
+
* storage and catalogs, and whether each table can be reached right now.
|
|
30
|
+
* Credentials are shown by name only; their values never leave the server.
|
|
31
|
+
*/
|
|
32
|
+
export function SourceList(props) {
|
|
33
|
+
const dataSource = useDataSource(props.dataSource);
|
|
34
|
+
const [sources, setSources] = useState();
|
|
35
|
+
const [error, setError] = useState();
|
|
36
|
+
const [tests, setTests] = useState({});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
let current = true;
|
|
39
|
+
dataSource
|
|
40
|
+
.listSources({})
|
|
41
|
+
.then((response) => current && setSources(response.sources))
|
|
42
|
+
.catch((e) => current && setError(messageOf(e)));
|
|
43
|
+
return () => {
|
|
44
|
+
current = false;
|
|
45
|
+
};
|
|
46
|
+
}, [dataSource]);
|
|
47
|
+
const test = (id) => {
|
|
48
|
+
if (!dataSource.testSource)
|
|
49
|
+
return;
|
|
50
|
+
setTests((previous) => ({ ...previous, [id]: "running" }));
|
|
51
|
+
dataSource
|
|
52
|
+
.testSource({ target: { case: "id", value: id } })
|
|
53
|
+
.then((response) => setTests((previous) => ({ ...previous, [id]: response })))
|
|
54
|
+
.catch((e) => setTests((previous) => ({ ...previous, [id]: { error: messageOf(e) } })));
|
|
55
|
+
};
|
|
56
|
+
if (error) {
|
|
57
|
+
return (_jsx("p", { className: "sf-search-error", role: "alert", children: error }));
|
|
58
|
+
}
|
|
59
|
+
if (!sources)
|
|
60
|
+
return _jsx("p", { className: "sf-object-muted", children: "Loading\u2026" });
|
|
61
|
+
if (sources.length === 0)
|
|
62
|
+
return _jsx("p", { className: "sf-object-muted", children: "No sources are configured." });
|
|
63
|
+
return (_jsx("ul", { className: ["sf-sources", props.className].filter(Boolean).join(" "), children: sources.map((source) => {
|
|
64
|
+
const result = tests[source.id];
|
|
65
|
+
const done = result && result !== "running" && !("error" in result) ? result : undefined;
|
|
66
|
+
return (_jsxs("li", { className: "sf-source", children: [_jsxs("header", { className: "sf-source-head", children: [_jsxs("div", { children: [_jsx("h3", { className: "sf-object-title", children: source.displayName || source.id }), _jsx("p", { className: "sf-object-facts", children: [source.id, ENGINE_LABEL[source.engine], source.readOnly ? "Read only" : undefined, source.capabilities?.timeTravel ? "Time travel" : undefined, source.capabilities?.storedResults ? "Keeps results" : undefined]
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.join(" · ") })] }), _jsxs("div", { className: "sf-object-buttons", children: [props.onSelect && (_jsx("button", { type: "button", className: "sf-button", onClick: () => props.onSelect?.(source), children: "Open" })), dataSource.testSource && (_jsx("button", { type: "button", className: "sf-button", disabled: result === "running", onClick: () => test(source.id), children: result === "running" ? "Testing…" : "Test connection" }))] })] }), source.connections.length > 0 && (_jsx("div", { className: "sf-object-table", tabIndex: 0, role: "region", "aria-label": `Connections of ${source.displayName || source.id}`, children: _jsxs("table", { children: [_jsxs("caption", { className: "sf-a2-visually-hidden", children: ["Connections of ", source.displayName || source.id] }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Connection" }), _jsx("th", { scope: "col", children: "Type" }), _jsx("th", { scope: "col", children: "Covers" }), _jsx("th", { scope: "col", children: "Signs in with" })] }) }), _jsx("tbody", { children: source.connections.map((connection) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: connection.name }), _jsx("td", { children: CONNECTION_LABEL[connection.kind] ?? "Other" }), _jsx("td", { className: "sf-object-type", children: connection.scope }), _jsx("td", { children: credentialText(connection) })] }, connection.name))) })] }) })), _jsxs("div", { "aria-live": "polite", children: [result && result !== "running" && "error" in result && (_jsx("p", { className: "sf-search-error", role: "alert", children: result.error })), done && (_jsxs(_Fragment, { children: [_jsxs("p", { className: "sf-source-result", "data-ok": done.ok || undefined, children: [_jsx("span", { "aria-hidden": "true", children: done.ok ? "✓" : "!" }), " ", done.message, done.engineVersion ? ` · ${ENGINE_LABEL[source.engine] ?? "Engine"} ${done.engineVersion}` : "", " \u00B7 ", Number(done.elapsedMs), " ms"] }), done.checks.length > 0 && (_jsx("ul", { className: "sf-source-checks", children: done.checks.map((check) => (_jsxs("li", { "data-ok": check.ok || undefined, children: [_jsx("span", { "aria-hidden": "true", children: check.ok ? "✓" : "!" }), _jsx("strong", { children: check.name }), _jsx("span", { children: check.ok ? "Reachable" : check.message })] }, check.name))) }))] }))] })] }, source.id));
|
|
69
|
+
}) }));
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=SourceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceList.js","sourceRoot":"","sources":["../../src/source/SourceList.tsx"],"names":[],"mappings":";AACA,OAAO,EAAmB,cAAc,EAAE,MAAM,EAAwC,MAAM,oBAAoB,CAAC;AACnH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AASpD,MAAM,YAAY,GAAoC;IACpD,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ;IACzB,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,YAAY;IACjC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU;IAC7B,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA4C;IACvE,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,WAAW;IAChC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,sBAAsB;IAC5C,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,eAAe;IACvC,CAA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AE,IAAI,SAAS,aAC3D,8BAAkB,MAAM,YAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAQ,OAAE,IAAI,CAAC,OAAO,EAClE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,cAAK,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,WACzH,EACH,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACzB,aAAI,SAAS,EAAC,kBAAkB,YAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC1B,yBAA8B,KAAK,CAAC,EAAE,IAAI,SAAS,aACjD,8BAAkB,MAAM,YAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAQ,EACtD,2BAAS,KAAK,CAAC,IAAI,GAAU,EAC7B,yBAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAQ,KAH9C,KAAK,CAAC,IAAI,CAId,CACN,CAAC,GACC,CACN,IACA,CACJ,IACG,KA3EC,MAAM,CAAC,EAAE,CA4Eb,CACN,CAAC;QACJ,CAAC,CAAC,GACC,CACN,CAAC;AACJ,CAAC","sourcesContent":["import type { DataSource } from \"@surfaces-ui/data\";\nimport { type Connection, ConnectionKind, Engine, type Source, type TestSourceResponse } from \"@surfaces-ui/proto\";\nimport { useEffect, useState } from \"react\";\nimport { useDataSource } from \"../data/DataSourceProvider.js\";\nimport { messageOf } from \"../data/useRowWindow.js\";\n\nexport interface SourceListProps {\n /** Called when a source is chosen. */\n onSelect?(source: Source): void;\n dataSource?: DataSource;\n className?: string;\n}\n\nconst ENGINE_LABEL: Partial<Record<Engine, string>> = {\n [Engine.DUCKDB]: \"DuckDB\",\n [Engine.DATAFUSION]: \"DataFusion\",\n [Engine.TERADATA]: \"Teradata\",\n [Engine.POSTGRES]: \"Postgres\",\n};\n\nexport const CONNECTION_LABEL: Partial<Record<ConnectionKind, string>> = {\n [ConnectionKind.S3]: \"Amazon S3\",\n [ConnectionKind.GCS]: \"Google Cloud Storage\",\n [ConnectionKind.AZURE]: \"Azure Storage\",\n [ConnectionKind.HTTP]: \"Web (https)\",\n [ConnectionKind.ICEBERG_REST]: \"Iceberg REST catalog\",\n [ConnectionKind.DATABASE_FILE]: \"Database file\",\n [ConnectionKind.POSTGRES]: \"Postgres database\",\n};\n\n/** How a connection signs in, in words. Only the secret's name is ever known here. */\nexport function credentialText(connection: Connection): string {\n if (connection.ambientCredentials) return \"The server's own cloud credentials\";\n return connection.credentialsSecret ? `Secret ${connection.credentialsSecret}` : \"None (public)\";\n}\n\n/**\n * The data sources a backend offers: what runs their SQL, how they reach\n * storage and catalogs, and whether each table can be reached right now.\n * Credentials are shown by name only; their values never leave the server.\n */\nexport function SourceList(props: SourceListProps) {\n const dataSource = useDataSource(props.dataSource);\n const [sources, setSources] = useState<Source[] | undefined>();\n const [error, setError] = useState<string | undefined>();\n const [tests, setTests] = useState<Record<string, TestSourceResponse | \"running\" | { error: string }>>({});\n\n useEffect(() => {\n let current = true;\n dataSource\n .listSources({})\n .then((response) => current && setSources(response.sources))\n .catch((e: unknown) => current && setError(messageOf(e)));\n return () => {\n current = false;\n };\n }, [dataSource]);\n\n const test = (id: string) => {\n if (!dataSource.testSource) return;\n setTests((previous) => ({ ...previous, [id]: \"running\" }));\n dataSource\n .testSource({ target: { case: \"id\", value: id } })\n .then((response) => setTests((previous) => ({ ...previous, [id]: response })))\n .catch((e: unknown) => setTests((previous) => ({ ...previous, [id]: { error: messageOf(e) } })));\n };\n\n if (error) {\n return (\n <p className=\"sf-search-error\" role=\"alert\">\n {error}\n </p>\n );\n }\n if (!sources) return <p className=\"sf-object-muted\">Loading…</p>;\n if (sources.length === 0) return <p className=\"sf-object-muted\">No sources are configured.</p>;\n\n return (\n <ul className={[\"sf-sources\", props.className].filter(Boolean).join(\" \")}>\n {sources.map((source) => {\n const result = tests[source.id];\n const done = result && result !== \"running\" && !(\"error\" in result) ? result : undefined;\n return (\n <li key={source.id} className=\"sf-source\">\n <header className=\"sf-source-head\">\n <div>\n <h3 className=\"sf-object-title\">{source.displayName || source.id}</h3>\n <p className=\"sf-object-facts\">\n {[source.id, ENGINE_LABEL[source.engine], source.readOnly ? \"Read only\" : undefined, source.capabilities?.timeTravel ? \"Time travel\" : undefined, source.capabilities?.storedResults ? \"Keeps results\" : undefined]\n .filter(Boolean)\n .join(\" · \")}\n </p>\n </div>\n <div className=\"sf-object-buttons\">\n {props.onSelect && (\n <button type=\"button\" className=\"sf-button\" onClick={() => props.onSelect?.(source)}>\n Open\n </button>\n )}\n {dataSource.testSource && (\n <button type=\"button\" className=\"sf-button\" disabled={result === \"running\"} onClick={() => test(source.id)}>\n {result === \"running\" ? \"Testing…\" : \"Test connection\"}\n </button>\n )}\n </div>\n </header>\n\n {source.connections.length > 0 && (\n <div className=\"sf-object-table\" tabIndex={0} role=\"region\" aria-label={`Connections of ${source.displayName || source.id}`}>\n <table>\n <caption className=\"sf-a2-visually-hidden\">Connections of {source.displayName || source.id}</caption>\n <thead>\n <tr>\n <th scope=\"col\">Connection</th>\n <th scope=\"col\">Type</th>\n <th scope=\"col\">Covers</th>\n <th scope=\"col\">Signs in with</th>\n </tr>\n </thead>\n <tbody>\n {source.connections.map((connection) => (\n <tr key={connection.name}>\n <th scope=\"row\">{connection.name}</th>\n <td>{CONNECTION_LABEL[connection.kind] ?? \"Other\"}</td>\n <td className=\"sf-object-type\">{connection.scope}</td>\n <td>{credentialText(connection)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n\n <div aria-live=\"polite\">\n {result && result !== \"running\" && \"error\" in result && (\n <p className=\"sf-search-error\" role=\"alert\">\n {result.error}\n </p>\n )}\n {done && (\n <>\n <p className=\"sf-source-result\" data-ok={done.ok || undefined}>\n <span aria-hidden=\"true\">{done.ok ? \"✓\" : \"!\"}</span> {done.message}\n {done.engineVersion ? ` · ${ENGINE_LABEL[source.engine] ?? \"Engine\"} ${done.engineVersion}` : \"\"} · {Number(done.elapsedMs)} ms\n </p>\n {done.checks.length > 0 && (\n <ul className=\"sf-source-checks\">\n {done.checks.map((check) => (\n <li key={check.name} data-ok={check.ok || undefined}>\n <span aria-hidden=\"true\">{check.ok ? \"✓\" : \"!\"}</span>\n <strong>{check.name}</strong>\n <span>{check.ok ? \"Reachable\" : check.message}</span>\n </li>\n ))}\n </ul>\n )}\n </>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n );\n}\n"]}
|