-
Notifications
You must be signed in to change notification settings - Fork 920
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
[RFC] New Homepage Technical Design #5251
Comments
Thanks Matt for the RFC.
|
|
Thanks Matt, I like the overall approach quite a bit. There are just a couple places where I think we may want a different approach: CategoriesI think the two proposed category types are a little too constrained by the existing mocks. What I take from them is that we want to make sure sections are capable of multiple column-based layouts. Instead of the two types you mention, I think a column-based template or layout system would be preferable. This design doesn't touch much on support for existing embeddables, but I imagine that a section with a 3 column layout could take 3 separate embeddables and could choose whether or not to make some or all of those editable/replaceable/removable. Props
IDsI don't think the id scheme here is consistent with saved objects in general. What you're talking about our references to other IDs (workspaces, users). This should happen in a dedicated field to store those references, not by trying to match IDs. |
I think what we delivered in terms of mocks was scoped to P0 and something that was easily duplicated for the purpose of speed. As I think about this from a framework perspective, i'd like to think about the system and the layout a bit more. To that end, i'd like to see a few of these props be a bit more flexible.
|
We specifically didn't include that in the P0, but yes, that's something we should account for in the high level design |
Nice! have a few suggestions and questions for the RFC: Suggestions:
Questions:
|
I would say if plugins are contributing embeddables, yes, but that would be to a custom section. Plugins should provide a row. |
related: #4966 |
|
I feel having something called I may consider simplifying the section API by removing the dedicated description: () => React.ReactNode |
@BSFishy Are we implementing some of this in 2.13? If so, can we update the release train value to 2.13? Or is there another issue related to 2.13 that we can attach the doc issue to: opensearch-project/documentation-website#5530. Thanks! |
Closed by #6065. There is still work to be done to make the new homepage meet its requirements, but that can be tied back to a separate issue |
New Homepage Technical Design
Overview
The homepage needs to be redesigned to provide useful links, including favorites, recents, and AI-based smart suggestions for visualizations wrapped up with a modernized visual aesthetic that includes an attractive dark mode that users now prefer.
There are separate implementations of the homepage for 1) the application, 2) a user, and 3) workspaces:
Section Implementation
Sections are meant to be a small part of the page with a common type of data. For example, this may be useful links to documentation, recently edited visualizations, etc.
Section Type API
The home plugin exposes an API which allows any plugin to register new sections. This API exposes a single function,
registerSection
, takes in a single object parameter for future compatibility. The API ships initially with limited points of customization, which can be expanded in the future if a proper use-case is found.The properties of the object are as follows:
id
(required, typestring
): This is a unique identifier for the section. It is what the plugin uses in the saved object to differentiate between sections and select the correct one to display.The structure of the identifier is
[plugin id]:[section slug]
. For example, the identifier for a section that contains recent visualizations, from thehome
plugin, might behome:recentVisualizations
. This format isn’t enforced in any way, however sections should be written following this pattern.title
(required, typestring
): This is the title of the section to be displayed in its title bar. This is user-facing and should be internationalized.Initially, this property’s type is
string
, however that may be expanded toReact.ReactElement
, without breaking, if needed.description
(required, typestring
): This is the description of the section to be displayed below its title. This is user-facing and should be internationalized.Initially, this property’s type is
string
, however that may be expanded toReact.ReactElement
, without breaking, if needed.documentationHref
(optional, typestring
): This is the URL to navigate to if the user clicks the “Documentation” link below the description. If this property is not provided, the documentation link will not be displayed.categories
(required, type({ data }) => Categories
): This is a function that returns categories. The argument is an object, which can be expanded in the future, initially containingdata
, which is a custom data field that the section can use for whatever it wants. This allows for a higher degree of customizability in section content.The
data
field is data taken directly from the saved object associated with this section instance. More information is in the Configuration section.Both the argument and return type of this function are an object. This is meant to increase compatibility with future versions, by allowing new fields to be added without breaking existing code. For example, an
id
orconfiguration
field could be added to the argument, allowing for more complex category generation code.Categories
return typeThe
Categories
return type is a type that is returned by thecategories
property of the section registration function. It is an object, which follows theExclusiveUnion
pattern from OUI:https://github.com/opensearch-project/oui/blob/1fe770cc662888be2d497da7352d6bf6f4f26cc4/src/components/common.ts#L177-L182
Essentially, there are multiple different types of categories, only one type of which is allowed to be used at a time. These types of categories are disambiguated by the
type
property.Unified categories
This is a type of categories where all the category blocks are surrounded by a single panel, providing a unified background. This is useful for a long horizontal list of items that aren’t broken up by distinct categories. An example of this is the “Recently accessed“ section in the proposal Github issue.
The properties of this type are:
type
(required, type‘unified’
): The type disambiguation fieldcategories
(required, typeReact.FunctionComponent<{}>
): This is a component which will render in the categories panel. The component does not initially have any properties, however may be extended with properties in the future.Ordered categories
This is a type of categories where the category blocks are defined in order. The order is not customizable by the home plugin, but the section could implement customizable ordering itself.
The properties of this type are:
type
(required, type‘ordered’
): The type disambiguation fieldcategories
(required, typeArray<React.FunctionComponent<{}>>
): This is an array of components, which will be rendered as categories in order. The components do not initially have any properties, however may be extended with properties in the future.Potential future categories
While these are the types of categories we want to support initially, there are a few types of categories that we may want to add in the future:
Configuration
To facilitate configuration, homepages utilize saved objects. There are separate saved object types for application, workspace, and user homepages, but they all contain similar structures. This common structure is as follows:
id
(typestring
): This is the unique identifier of the saved object. It may be given a special meaning given the type of the homepage.sections
(typeArray<Section>
): This is an ordered list of sections.Section
typetype
(typestring
): The type of the section. This is how the renderer know what type of section to render and directly maps to the section ID used in the section type API.data
(optional, typeunknown
): Arbitrary data for use by the section. This type isunknown
to allow this data to be anything that the section would like; there is no restriction on the type of data to be provided.Types of Saved Objects
Each type of homepage gets its own type of saved object:
User configuration options
Upon initial release, the most flexible way to configure the homepage is through saved object management. Of course, the user can add sections, reorder sections, and dismiss sections from the homepage itself, however beyond that any configuration shall be done through saved object management. For example, if a section allows for arbitrary data, the only way to edit that is through saved object management.
Future configuration options
In the future there may be a number of ways to configure the homepage:
Front-end
Rendering the homepage is relatively simple. The main task is getting the correct saved object configuration, which is handled by the individual page (application vs user vs workspace homepage) then passed to a unified homepage component.
The overall flow for any given homepage is the same and is as follows:
React.ReactElement
sReact.ReactElement
Sections
A section is a reusable component to be displayed on the homepage. The component props are as follows:
title
(required, typestring
): The title to be displayed at the top of the section. The should come from the configuration and already be internationalized.description
(required, typestring
): The description to be displayed below the title. This should come from the configuration and already be internationalized.documentationHref
(optional, typestring
): The URL to navigate to when the user clicks the “Documentation” link below the description. This should come from the configuration.categories
(required, typeReact.ReactElement
): This is the element to be displayed in the categories area.The component is defined as follows:
EuiFlexGroup
set up as a row. The items are:title
prop of the component. This flex item is set to grow and take up any extra space.EuiFlexGroup
set up as a row. The items are split up in a 1:3 ratio. The items are:documentationHref
prop is provided to the component. The text is always “Documentation”, and theEuiLink
always hasexternal
set to true.categories
prop of the component.Other considerations
The text was updated successfully, but these errors were encountered: