-
Notifications
You must be signed in to change notification settings - Fork 6
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
Integrates STAC metadata request #645
Conversation
✅ Deploy Preview for veda-ui ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
export interface TimelineDatasetData extends DatasetLayer { | ||
isPeriodic: boolean; | ||
timeDensity: TimeDensity; | ||
domain: Date[]; | ||
} | ||
|
||
export interface TimelineDataset { | ||
status: TimelineDatasetStatus; | ||
data: any; | ||
data: TimelineDatasetData; | ||
error: any; | ||
settings: { | ||
// user defined settings like visibility, opacity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nerik How much type narrowing should we be doing?
The isPeriodic
and so on properties are only available when the status is success
, otherwise they're undefined
. We could do this type narrowing or set it to be possibly undefined. On one hand we have a more complicated type, but with undefined
, we need to check every prop, instead of relying on status. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, not sure what's going on, but do the following:
- Add a dataset. Time extent displays fine on the timeline
- Add another dataset. After the STAC endpoint fetch, no time extent displayed for both datasets.
// END TimelineDatasetAnalysis type discriminants | ||
|
||
export interface TimelineDatasetData extends DatasetLayer { | ||
isPeriodic: boolean; | ||
timeDensity: TimeDensity; | ||
domain: Date[]; | ||
} | ||
|
||
// TimelineDataset type discriminants | ||
export interface TimelineDatasetIdle { | ||
status: TimelineDatasetStatus.IDLE; | ||
data: DatasetLayer; | ||
error: null; | ||
settings: { | ||
// user defined settings like visibility, opacity | ||
isVisible?: boolean; | ||
opacity?: number; | ||
}; | ||
analysis: TimelineDatasetAnalysisIdle; | ||
} | ||
export interface TimelineDatasetLoading { | ||
status: TimelineDatasetStatus.LOADING; | ||
data: DatasetLayer; | ||
error: null; | ||
settings: { | ||
// user defined settings like visibility, opacity | ||
isVisible?: boolean; | ||
opacity?: number; | ||
}; | ||
analysis: TimelineDatasetAnalysisIdle; | ||
} | ||
export interface TimelineDatasetError { | ||
status: TimelineDatasetStatus.ERROR; | ||
data: DatasetLayer; | ||
error: unknown; | ||
settings: { | ||
// user defined settings like visibility, opacity | ||
isVisible?: boolean; | ||
opacity?: number; | ||
}; | ||
analysis: TimelineDatasetAnalysisIdle; | ||
} | ||
export interface TimelineDatasetSuccess { | ||
status: TimelineDatasetStatus.SUCCESS; | ||
data: TimelineDatasetData; | ||
error: null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified by:
- wrapping settings into a common Settings typr:
interface Settings {
isVisible?: boolean;
opacity?: number;
}
- extend a base type for all the unioned types:
interface TimelineDatasetBase {
data: DatasetLayer | TimelineDatasetData;
error: unknown | null;
settings: Settings;
analysis: TimelineDatasetAnalysisIdle | TimelineDatasetAnalysis;
}
@nerik whit which datasets did you notice this happening? |
@nerik now that we addresses the issues with the dataset domain, I think this is good to go. Can you have a final check? |
When datasets are added to the timeline, metadata from STAC is requested and reconciles with local data