Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update some fields optional in UI parser #2380

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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