Skip to content

Commit

Permalink
fix: Update some fields optional in UI parser (#2380)
Browse files Browse the repository at this point in the history
Signed-off-by: Yun Nan Liu <yunnanl@twitter.com>

Co-authored-by: Yun Nan Liu <yunnanl@twitter.com>
Co-authored-by: Danny Chiao <danny@tecton.ai>
  • Loading branch information
3 people authored Mar 7, 2022
1 parent 71d7ae2 commit cff7ac3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
13 changes: 11 additions & 2 deletions ui/src/pages/entities/EntityOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
EuiText,
EuiFlexItem,
EuiSpacer,
EuiStat,
EuiDescriptionList,
EuiDescriptionListTitle,
EuiDescriptionListDescription,
Expand Down Expand Up @@ -71,12 +72,20 @@ const EntityOverviewTab = () => {
<EuiDescriptionList>
<EuiDescriptionListTitle>Created</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{data.meta.createdTimestamp.toLocaleDateString("en-CA")}
{data.meta.createdTimestamp ? (
data.meta.createdTimestamp.toLocaleDateString("en-CA")
) : (
<EuiText>No createdTimestamp specified on this entity.</EuiText>
)}
</EuiDescriptionListDescription>

<EuiDescriptionListTitle>Updated</EuiDescriptionListTitle>
<EuiDescriptionListDescription>
{data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA")}
{data.meta.lastUpdatedTimestamp ? (
data.meta.lastUpdatedTimestamp.toLocaleDateString("en-CA")
) : (
<EuiText>No lastUpdatedTimestamp specified on this entity.</EuiText>
)}
</EuiDescriptionListDescription>
</EuiDescriptionList>
</EuiPanel>
Expand Down
5 changes: 3 additions & 2 deletions ui/src/pages/feature-views/RegularFeatureViewOverviewTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const RegularFeatureViewOverviewTab = ({
<EuiFlexItem>
<EuiStat title={`${numOfFs}`} description="Consuming Services" />
</EuiFlexItem>
{data.spec.batchSource.meta && (
{data.spec.batchSource.meta ? (
<EuiFlexItem>
<EuiStat
title={data.spec.batchSource.meta.latestEventTimestamp.toLocaleDateString(
Expand All @@ -70,8 +70,9 @@ const RegularFeatureViewOverviewTab = ({
titleColor="subdued"
/>
</EuiFlexItem>
) : (
<EuiText>No batchSource specified on this feature view.</EuiText>
)}

{data.meta.lastUpdatedTimestamp && (
<EuiFlexItem>
<EuiStat
Expand Down
4 changes: 2 additions & 2 deletions ui/src/parsers/feastEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const FeastEntitySchema = z.object({
labels: 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(),
}),
});

Expand Down
6 changes: 3 additions & 3 deletions ui/src/parsers/feastFeatureViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions ui/src/parsers/parseEntityRelationships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit cff7ac3

Please sign in to comment.