Skip to content

Commit f20a633

Browse files
authored
Merge branch 'main' into ravenac95/fix-table-replace
2 parents cf770e3 + c294e3e commit f20a633

File tree

8 files changed

+66
-49
lines changed

8 files changed

+66
-49
lines changed

apps/frontend/components/widgets/model-context-editor.tsx

Lines changed: 50 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { DataTable } from "@/components/ui/data-table";
3434
interface ModelContextEditorProps {
3535
datasetId: string;
3636
modelId: string;
37-
schema: DataModelColumn[];
37+
schema?: DataModelColumn[];
3838
existingContext?: Pick<ModelContext, "context" | "columnContext"> | null;
3939
className?: string;
4040
}
@@ -65,7 +65,7 @@ function ModelContextEditor(props: ModelContextEditorProps) {
6565

6666
// Filter existing column contexts to only include columns that exist in the current schema
6767
const filteredColumnContexts = useMemo(() => {
68-
if (!existingContext?.columnContext) return [];
68+
if (!existingContext?.columnContext || !schema) return [];
6969

7070
const schemaColumnNames = new Set(schema.map((col) => col.name));
7171
return existingContext.columnContext.filter((colCtx) =>
@@ -78,7 +78,7 @@ function ModelContextEditor(props: ModelContextEditorProps) {
7878
resolver: zodResolver(modelContextSchema),
7979
defaultValues: {
8080
tableContext: existingContext?.context || "",
81-
columnContexts: schema.map((column) => {
81+
columnContexts: schema?.map((column) => {
8282
const existingColContext = filteredColumnContexts.find(
8383
(ctx) => ctx.name === column.name,
8484
);
@@ -93,12 +93,12 @@ function ModelContextEditor(props: ModelContextEditorProps) {
9393
// Prepare data for DataTable
9494
const tableData: ColumnRow[] = useMemo(
9595
() =>
96-
schema.map((column, index) => ({
96+
schema?.map((column, index) => ({
9797
columnName: column.name,
9898
columnType: column.type,
9999
columnDescription: column.description,
100100
index,
101-
})),
101+
})) ?? [],
102102
[schema],
103103
);
104104

@@ -165,7 +165,7 @@ function ModelContextEditor(props: ModelContextEditorProps) {
165165

166166
try {
167167
// Filter out empty contexts and only include columns that exist in schema
168-
const schemaColumnNames = new Set(schema.map((col) => col.name));
168+
const schemaColumnNames = new Set(schema?.map((col) => col.name));
169169
const columnContext = data.columnContexts
170170
.filter((ctx) => ctx.context && ctx.context.trim() !== "")
171171
.filter((ctx) => schemaColumnNames.has(ctx.name))
@@ -209,43 +209,51 @@ function ModelContextEditor(props: ModelContextEditorProps) {
209209
Table schema and context to help the AI understand your model
210210
</CardDescription>
211211
</CardHeader>
212-
<Form {...form}>
213-
<form onSubmit={safeSubmit(form.handleSubmit(onSubmit))}>
214-
<CardContent className="space-y-4">
215-
<FormField
216-
control={form.control}
217-
name="tableContext"
218-
render={({ field }) => (
219-
<FormItem>
220-
<FormLabel className="text-sm">Table Context</FormLabel>
221-
<FormControl>
222-
<Textarea
223-
{...field}
224-
placeholder="Describe the purpose and usage of this table..."
225-
rows={2}
226-
className="text-sm"
227-
/>
228-
</FormControl>
229-
<FormMessage />
230-
</FormItem>
231-
)}
232-
/>
233-
234-
<div className="space-y-2">
235-
<DataTable
236-
columns={columns}
237-
data={tableData}
238-
pagination={false}
212+
{!schema || schema.length === 0 ? (
213+
<CardContent>
214+
<p className="text-sm text-muted-foreground">
215+
No schema found. Please trigger a new run
216+
</p>
217+
</CardContent>
218+
) : (
219+
<Form {...form}>
220+
<form onSubmit={safeSubmit(form.handleSubmit(onSubmit))}>
221+
<CardContent className="space-y-4">
222+
<FormField
223+
control={form.control}
224+
name="tableContext"
225+
render={({ field }) => (
226+
<FormItem>
227+
<FormLabel className="text-sm">Table Context</FormLabel>
228+
<FormControl>
229+
<Textarea
230+
{...field}
231+
placeholder="Describe the purpose and usage of this table..."
232+
rows={2}
233+
className="text-sm"
234+
/>
235+
</FormControl>
236+
<FormMessage />
237+
</FormItem>
238+
)}
239239
/>
240-
</div>
241-
</CardContent>
242-
<CardFooter className="pt-3">
243-
<Button type="submit" disabled={isSubmitting} size="sm">
244-
{isSubmitting ? "Saving..." : "Save"}
245-
</Button>
246-
</CardFooter>
247-
</form>
248-
</Form>
240+
241+
<div className="space-y-2">
242+
<DataTable
243+
columns={columns}
244+
data={tableData}
245+
pagination={false}
246+
/>
247+
</div>
248+
</CardContent>
249+
<CardFooter className="pt-3">
250+
<Button type="submit" disabled={isSubmitting} size="sm">
251+
{isSubmitting ? "Saving..." : "Save"}
252+
</Button>
253+
</CardFooter>
254+
</form>
255+
</Form>
256+
)}
249257
</Card>
250258
);
251259
}

apps/frontend/stories/widgets/model-context-editor.stories.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,12 @@ export const MinimalSchema: Story = {
243243
existingContext: null,
244244
},
245245
};
246+
247+
export const NoSchema: Story = {
248+
args: {
249+
datasetId: "dataset_004",
250+
modelId: "pending_model",
251+
schema: undefined,
252+
existingContext: null,
253+
},
254+
};

ops/clusters/warehouse/production-apps.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ spec:
2121
images:
2222
- name: ghcr.io/opensource-observer/oso
2323
newName: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
24-
newTag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
24+
newTag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}

ops/k8s-apps/production/agent/custom-helm-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
images:
99
- name: ghcr.io/opensource-observer/oso
1010
newName: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
11-
newTag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
11+
newTag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
1212
values:
1313
app:
1414
service:

ops/k8s-apps/production/dagster/custom-helm-values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ spec:
9292
- name: "default"
9393
image:
9494
repository: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
95-
tag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
95+
tag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
9696
pullPolicy: IfNotPresent
9797
envConfigMaps:
9898
- name: dagster-oso-extra-env
@@ -107,7 +107,7 @@ spec:
107107
- name: "dynamic"
108108
image:
109109
repository: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
110-
tag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
110+
tag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
111111
pullPolicy: IfNotPresent
112112
envConfigMaps:
113113
- name: dagster-oso-extra-env

ops/k8s-apps/production/mcp/custom-helm-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
images:
99
- name: ghcr.io/opensource-observer/oso
1010
newName: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
11-
newTag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
11+
newTag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
1212
values:
1313
app:
1414
envVars:

ops/k8s-apps/production/metrics-service/custom-helm-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
images:
99
- name: ghcr.io/opensource-observer/oso
1010
newName: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
11-
newTag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
11+
newTag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
1212
values:
1313
mcs:
1414
frontend:

ops/k8s-apps/production/scheduler/custom-helm-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
images:
99
- name: ghcr.io/opensource-observer/oso
1010
newName: ghcr.io/opensource-observer/oso # {"$imagepolicy": "flux-system:oso:name"}
11-
newTag: deploy-20260126200909-6016535 # {"$imagepolicy": "flux-system:oso:tag"}
11+
newTag: deploy-20260126210530-6326ce7 # {"$imagepolicy": "flux-system:oso:tag"}
1212
values:
1313
app:
1414
queues:

0 commit comments

Comments
 (0)