From cff7ac3c6440a78a7fa460b2f19bc07d9ea5aab2 Mon Sep 17 00:00:00 2001 From: mickey-liu Date: Mon, 7 Mar 2022 15:24:04 -0800 Subject: [PATCH] fix: Update some fields optional in UI parser (#2380) Signed-off-by: Yun Nan Liu Co-authored-by: Yun Nan Liu Co-authored-by: Danny Chiao --- ui/src/pages/entities/EntityOverviewTab.tsx | 13 +++++++++++-- .../feature-views/RegularFeatureViewOverviewTab.tsx | 5 +++-- ui/src/parsers/feastEntities.ts | 4 ++-- ui/src/parsers/feastFeatureViews.ts | 6 +++--- ui/src/parsers/parseEntityRelationships.ts | 4 ++-- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ui/src/pages/entities/EntityOverviewTab.tsx b/ui/src/pages/entities/EntityOverviewTab.tsx index ed539ff5ee..dce0c12824 100644 --- a/ui/src/pages/entities/EntityOverviewTab.tsx +++ b/ui/src/pages/entities/EntityOverviewTab.tsx @@ -9,6 +9,7 @@ import { EuiText, EuiFlexItem, EuiSpacer, + EuiStat, EuiDescriptionList, EuiDescriptionListTitle, EuiDescriptionListDescription, @@ -71,12 +72,20 @@ const EntityOverviewTab = () => { Created - {data.meta.createdTimestamp.toLocaleDateString("en-CA")} + {data.meta.createdTimestamp ? ( + data.meta.createdTimestamp.toLocaleDateString("en-CA") + ) : ( + No createdTimestamp specified on this entity. + )} Updated - {data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA")} + {data.meta.lastUpdatedTimestamp ? ( + data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA") + ) : ( + No lastUpdatedTimestamp specified on this entity. + )} diff --git a/ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx b/ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx index 70a7fdec17..4475b6ad0c 100644 --- a/ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx +++ b/ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx @@ -60,7 +60,7 @@ const RegularFeatureViewOverviewTab = ({ - {data.spec.batchSource.meta && ( + {data.spec.batchSource.meta ? ( + ) : ( + No batchSource specified on this feature view. )} - {data.meta.lastUpdatedTimestamp && ( new Date(val)), - lastUpdatedTimestamp: z.string().transform((val) => new Date(val)), + createdTimestamp: z.string().transform((val) => new Date(val)).optional(), + lastUpdatedTimestamp: z.string().transform((val) => new Date(val)).optional(), }), }); diff --git a/ui/src/parsers/feastFeatureViews.ts b/ui/src/parsers/feastFeatureViews.ts index 013f70b1fe..c8cdadd25c 100644 --- a/ui/src/parsers/feastFeatureViews.ts +++ b/ui/src/parsers/feastFeatureViews.ts @@ -13,7 +13,7 @@ const FeastBatchSourceSchema = z.object({ fileOptions: z.object({ fileUrl: z.string().optional(), }).optional(), - name: z.string(), + name: z.string().optional(), meta: z.object({ earliestEventTimestamp: z.string().transform((val) => new Date(val)), latestEventTimestamp: z.string().transform((val) => new Date(val)), @@ -39,8 +39,8 @@ const FeastFeatureViewSchema = z.object({ tags: z.record(z.string()).optional(), }), meta: z.object({ - createdTimestamp: z.string().transform((val) => new Date(val)), - lastUpdatedTimestamp: z.string().transform((val) => new Date(val)), + createdTimestamp: z.string().transform((val) => new Date(val)).optional(), + lastUpdatedTimestamp: z.string().transform((val) => new Date(val)).optional(), materializationIntervals: z .array( z.object({ diff --git a/ui/src/parsers/parseEntityRelationships.ts b/ui/src/parsers/parseEntityRelationships.ts index f6e1b1af1f..bf82e86ff9 100644 --- a/ui/src/parsers/parseEntityRelationships.ts +++ b/ui/src/parsers/parseEntityRelationships.ts @@ -46,7 +46,7 @@ const parseEntityRelationships = (objects: FeastRegistryType) => { links.push({ source: { type: FEAST_FCO_TYPES["dataSource"], - name: fv.spec.batchSource.name + name: fv.spec.batchSource.name || '' }, target: { type: FEAST_FCO_TYPES["featureView"], @@ -77,7 +77,7 @@ const parseEntityRelationships = (objects: FeastRegistryType) => { links.push({ source: { type: FEAST_FCO_TYPES["dataSource"], - name: source_fv?.spec.batchSource.name, + name: source_fv?.spec.batchSource.name || '', }, target: { type: FEAST_FCO_TYPES["featureView"],