-
Notifications
You must be signed in to change notification settings - Fork 901
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
Add framework to show related indexed views inside dataset selector and show banner in the Discover canvas for the selected dataset #8818
Conversation
…s in dataset selector Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: Riya Saxena <[email protected]>
Signed-off-by: Riya Saxena <[email protected]>
changelogs/fragments/8818.yml
Outdated
@@ -0,0 +1,3 @@ | |||
feat: | |||
- Add framework to show banner at the top in discover results canvas ([#8701](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8818)) |
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.
think you also want to update 8701
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.
updated
Signed-off-by: Riya Saxena <[email protected]>
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.
Re-running ci to see if some checks will pass (different set than last time) but approving to unblock.
Will want to follow up and correct the pr number in the changelog fragment
Signed-off-by: Riya Saxena <[email protected]>
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.
Checked screenshot for cigroup6, refresh button was present so likely a delay in showing up
| { | ||
componentType: DatasetCanvasBannerComponentType.CALLOUT; | ||
title: string; | ||
iconType?: string; |
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.
how come iconType vs the actual icon following the current pattern: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data/common/datasets/types.ts#L155
|
||
export type DatasetCanvasBannerProps = | ||
| { | ||
componentType: DatasetCanvasBannerComponentType.CALLOUT; |
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.
if my understanding of this is correct. This should just be type
as it is redundant if this component is already a component and developers will understand that the type
is associated to the type of component.
@@ -256,6 +258,29 @@ export interface DatasetField { | |||
// TODO: osdFieldType? | |||
} | |||
|
|||
export enum DatasetCanvasBannerComponentType { | |||
CALLOUT = 'callout', |
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.
thanks for making this a string. but could we follow current pattern could we make this all caps: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data/common/datasets/types.ts#L136
might be a nitpick but it's easier to write code expecting strings to be in a certain casing
@@ -256,6 +258,29 @@ export interface DatasetField { | |||
// TODO: osdFieldType? | |||
} | |||
|
|||
export enum DatasetCanvasBannerComponentType { | |||
CALLOUT = 'callout', | |||
CUSTOM = 'custom', |
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.
CUSTOM = 'custom', | |
CUSTOM = 'CUSTOM', |
|
||
export type DatasetCanvasBannerProps = | ||
| { | ||
componentType: DatasetCanvasBannerComponentType.CALLOUT; |
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.
componentType: DatasetCanvasBannerComponentType.CALLOUT; | |
type: DatasetCanvasBannerComponentType.CALLOUT; |
@@ -493,6 +493,7 @@ export { | |||
QueryStart, | |||
PersistedLog, | |||
LanguageReference, | |||
IndexedViewsService, |
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.
Didn't we rename this to DatasetIndexedViewsService
?
@@ -34,6 +34,7 @@ export { | |||
DatasetService, | |||
DatasetServiceContract, | |||
DatasetTypeConfig, | |||
DatasetIndexedViewsService as IndexedViewsService, |
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.
The whole point of prefixing is to avoid name collision. Exporting it without a prefix out of here doesn't mitigate that.
CUSTOM = 'custom', | ||
} | ||
|
||
export type DatasetCanvasBannerProps = |
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.
i think we should have a BaseDatasetCanvasBannerProps
or DatasetCanvasBannerProps
that has required props to add a new banner. Then create a type called DatasetCanvasCalloutBannerProps
and DatasetCanvasCustomBannerProps
or something.
if developing these union types become quiet difficult to understand sometimes and caused the linter to complain because the type isn't strict enough. easier to work with explicit types.
as far as the base props i think we should have at least
export type DatasetCanvasBannerProps = {
// required. unique id, this will be used to associate a dataset to a canvas props. this is different than title because title is something that could be displayed but if i have two devs trying to add a new banner called `Index Callout Banner` (haven't looked at the code yet) but if the component doesn't change in an ID then maybe we won't render an update by accident.
id: string;
title: string; // required. going from optional to required would be a breaking change. and haven't looked at how this is used but i can imagine we don't really want to have a case where title is undefined.
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.
that or title
to be name
similar to the flyout stuff.
we should also consider maybe key
but we should def include
className?: string;
'data-test-subj'?: string;
writing tests on this abstract types would make this so much easier and if we have to style them the className will help
@@ -256,6 +258,29 @@ export interface DatasetField { | |||
// TODO: osdFieldType? | |||
} | |||
|
|||
export enum DatasetCanvasBannerComponentType { |
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.
export enum DatasetCanvasBannerComponentType { | |
export enum DATASET_CANVAS_BANNER_COMPONENT_TYPES { |
@@ -247,6 +247,8 @@ export interface Dataset extends BaseDataset { | |||
timeFieldName?: string; | |||
/** Optional language to default to from the language selector */ | |||
language?: string; | |||
/** Optional name of the indexed view to search data from */ | |||
indexedView?: string; |
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.
could you add more insight on what this is?
is this to be the id of the indexedView component. is this a unique id generated from something?
without much context this for me this seems something like a data view is that correct @riysaxen-amzn ? if you can update to include an example above that would help with this insight
can any developer add an indexed view or is it only related to a specific data type? the dataset
interface was derived from the index pattern interface so that we can leverage the current system setup. the current system setup assumes the title is the thing it will query. if this is changing that assumption it might be worth considering if this is a different interface like DataViewset extends BaseDataset
cc: @virajsanghvi, @AMoo-Miki , @ashwin-pc curious your opinion here
@@ -40,10 +41,21 @@ export const Configurator = ({ | |||
const queryString = queryService.queryString; | |||
const languageService = queryService.queryString.getLanguageService(); | |||
const indexPatternsService = getIndexPatterns(); | |||
const type = queryString.getDatasetService().getType(baseDataset.type); | |||
const type = queryString?.getDatasetService().getType(baseDataset.type); |
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.
queryString manager shouldn't be optional how come? the type might be undefined but the app won't work if queryString is undefined
Co-authored-by: Kawika Avilla <[email protected]> Signed-off-by: Riya <[email protected]>
@riysaxen-amzn FYI, noticed there is a conflict :) |
Description
This has all the changes from Base PR: #8701
and UTs for Configurator
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration