Skip to content

Commit a2487b8

Browse files
mickey-liuYun Nan Liuadchia
committed
fix: Update some fields optional in UI parser (feast-dev#2380)
Signed-off-by: Yun Nan Liu <[email protected]> Co-authored-by: Yun Nan Liu <[email protected]> Co-authored-by: Danny Chiao <[email protected]>
1 parent f0b47a7 commit a2487b8

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

ui/src/pages/entities/EntityOverviewTab.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
EuiText,
1010
EuiFlexItem,
1111
EuiSpacer,
12+
EuiStat,
1213
EuiDescriptionList,
1314
EuiDescriptionListTitle,
1415
EuiDescriptionListDescription,
@@ -71,12 +72,20 @@ const EntityOverviewTab = () => {
7172
<EuiDescriptionList>
7273
<EuiDescriptionListTitle>Created</EuiDescriptionListTitle>
7374
<EuiDescriptionListDescription>
74-
{data.meta.createdTimestamp.toLocaleDateString("en-CA")}
75+
{data.meta.createdTimestamp ? (
76+
data.meta.createdTimestamp.toLocaleDateString("en-CA")
77+
) : (
78+
<EuiText>No createdTimestamp specified on this entity.</EuiText>
79+
)}
7580
</EuiDescriptionListDescription>
7681

7782
<EuiDescriptionListTitle>Updated</EuiDescriptionListTitle>
7883
<EuiDescriptionListDescription>
79-
{data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA")}
84+
{data.meta.lastUpdatedTimestamp ? (
85+
data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA")
86+
) : (
87+
<EuiText>No lastUpdatedTimestamp specified on this entity.</EuiText>
88+
)}
8089
</EuiDescriptionListDescription>
8190
</EuiDescriptionList>
8291
</EuiPanel>

ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const RegularFeatureViewOverviewTab = ({
6060
<EuiFlexItem>
6161
<EuiStat title={`${numOfFs}`} description="Consuming Services" />
6262
</EuiFlexItem>
63-
{data.spec.batchSource.meta && (
63+
{data.spec.batchSource.meta ? (
6464
<EuiFlexItem>
6565
<EuiStat
6666
title={data.spec.batchSource.meta.latestEventTimestamp.toLocaleDateString(
@@ -70,8 +70,9 @@ const RegularFeatureViewOverviewTab = ({
7070
titleColor="subdued"
7171
/>
7272
</EuiFlexItem>
73+
) : (
74+
<EuiText>No batchSource specified on this feature view.</EuiText>
7375
)}
74-
7576
{data.meta.lastUpdatedTimestamp && (
7677
<EuiFlexItem>
7778
<EuiStat

ui/src/parsers/feastEntities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const FeastEntitySchema = z.object({
1010
labels: z.record(z.string()).optional(),
1111
}),
1212
meta: z.object({
13-
createdTimestamp: z.string().transform((val) => new Date(val)),
14-
lastUpdatedTimestamp: z.string().transform((val) => new Date(val)),
13+
createdTimestamp: z.string().transform((val) => new Date(val)).optional(),
14+
lastUpdatedTimestamp: z.string().transform((val) => new Date(val)).optional(),
1515
}),
1616
});
1717

ui/src/parsers/feastFeatureViews.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const FeastBatchSourceSchema = z.object({
1313
fileOptions: z.object({
1414
fileUrl: z.string().optional(),
1515
}).optional(),
16-
name: z.string(),
16+
name: z.string().optional(),
1717
meta: z.object({
1818
earliestEventTimestamp: z.string().transform((val) => new Date(val)),
1919
latestEventTimestamp: z.string().transform((val) => new Date(val)),
@@ -39,8 +39,8 @@ const FeastFeatureViewSchema = z.object({
3939
tags: z.record(z.string()).optional(),
4040
}),
4141
meta: z.object({
42-
createdTimestamp: z.string().transform((val) => new Date(val)),
43-
lastUpdatedTimestamp: z.string().transform((val) => new Date(val)),
42+
createdTimestamp: z.string().transform((val) => new Date(val)).optional(),
43+
lastUpdatedTimestamp: z.string().transform((val) => new Date(val)).optional(),
4444
materializationIntervals: z
4545
.array(
4646
z.object({

ui/src/parsers/parseEntityRelationships.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const parseEntityRelationships = (objects: FeastRegistryType) => {
4646
links.push({
4747
source: {
4848
type: FEAST_FCO_TYPES["dataSource"],
49-
name: fv.spec.batchSource.name
49+
name: fv.spec.batchSource.name || ''
5050
},
5151
target: {
5252
type: FEAST_FCO_TYPES["featureView"],
@@ -77,7 +77,7 @@ const parseEntityRelationships = (objects: FeastRegistryType) => {
7777
links.push({
7878
source: {
7979
type: FEAST_FCO_TYPES["dataSource"],
80-
name: source_fv?.spec.batchSource.name,
80+
name: source_fv?.spec.batchSource.name || '',
8181
},
8282
target: {
8383
type: FEAST_FCO_TYPES["featureView"],

0 commit comments

Comments
 (0)