-
Notifications
You must be signed in to change notification settings - Fork 1k
[HomePage] Add recent work section and additional styling for home page #6277
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
[HomePage] Add recent work section and additional styling for home page #6277
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6277 +/- ##
==========================================
+ Coverage 67.55% 67.67% +0.11%
==========================================
Files 3469 3470 +1
Lines 68479 68513 +34
Branches 11130 11130
==========================================
+ Hits 46264 46368 +104
+ Misses 19512 19425 -87
- Partials 2703 2720 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Two things i want to call out here:
- How do i see the recently accessed section? Pulling down the PR and loading the new homepage does not have this section. Also can you add a screenshot to the PR so that people who dont pull down the change can see it too?
- You are modifying the architecture of the section component. That seems unnecessary for the filter but want to hear more on why you think the option you proposed is the best way to do it and what are the other alternitives you've tried.
src/plugins/discover/public/application/view_components/utils/use_search.ts
Outdated
Show resolved
Hide resolved
src/plugins/home/public/application/components/homepage/section.tsx
Outdated
Show resolved
Hide resolved
Added a comment here about the necessity of adding a filter button on the recent work section: #6066 (comment) Changed the rendering structure of section back to previous way. |
src/plugins/discover/public/application/view_components/utils/use_search.ts
Outdated
Show resolved
Hide resolved
c1d0d0b
to
ef3e843
Compare
src/core/public/chrome/recently_accessed/recently_accessed_service.ts
Outdated
Show resolved
Hide resolved
src/plugins/dashboard/public/application/utils/use/use_saved_dashboard_instance.ts
Outdated
Show resolved
Hide resolved
src/plugins/home/public/application/components/homepage/sections/recent_work.tsx
Outdated
Show resolved
Hide resolved
Hi @abbyhu2000 , is this PR targeting 2.15 or 2.16? |
ef3e843
to
8e68eef
Compare
7d03e73
to
2fa121e
Compare
Signed-off-by: abbyhu2000 <[email protected]>
43d0169
to
ebab353
Compare
Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
if (extraProps) { | ||
const type = extraProps!.type; | ||
const updatedAt = extraProps!.updatedAt; | ||
history.add({ | ||
link, | ||
label, | ||
id, | ||
...(currentWorkspaceId && { workspaceId: currentWorkspaceId }), | ||
type, | ||
updatedAt, | ||
}); | ||
} else { | ||
history.add({ | ||
link, | ||
label, | ||
id, | ||
...(currentWorkspaceId && { workspaceId: currentWorkspaceId }), | ||
}); | ||
} |
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 (extraProps) { | |
const type = extraProps!.type; | |
const updatedAt = extraProps!.updatedAt; | |
history.add({ | |
link, | |
label, | |
id, | |
...(currentWorkspaceId && { workspaceId: currentWorkspaceId }), | |
type, | |
updatedAt, | |
}); | |
} else { | |
history.add({ | |
link, | |
label, | |
id, | |
...(currentWorkspaceId && { workspaceId: currentWorkspaceId }), | |
}); | |
} | |
history.add({ | |
link, | |
label, | |
id, | |
...(currentWorkspaceId && { workspaceId: currentWorkspaceId }), | |
...extraProps, | |
}); |
What about we simplifying the code like this?
const render = renderFn(() => { | ||
const services = getServices(); | ||
const navigateToUrl = services.application.navigateToUrl; | ||
const recentAccessed = useObservable(services.chrome.recentlyAccessed.get$(), []); |
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 suppose the correct order here should be:
- Filter by type
- Slice to no more than 8 items
- render the items
savedObject.getOpenSearchType(), | ||
moment(Date.now()).format('MM/DD/YYYY HH:mm') |
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.
savedObject.getOpenSearchType(), | |
moment(Date.now()).format('MM/DD/YYYY HH:mm') | |
{ type: savedObject.getOpenSearchType(), updateAt: Date.now() } |
Should be like this?
@@ -74,6 +74,13 @@ export const useSavedVisBuilderVis = (visualizationIdFromUrl: string | undefined | |||
data.query.filterManager.setAppFilters(actualFilters); | |||
data.query.queryString.setQuery(query); | |||
|
|||
chrome.recentlyAccessed.add( |
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.
Seems the call does not comply with the interface of chrome.recentlyAccessed.add
.
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.
Did a cursory review. Have some questions about the implementation details but given that we are going a different direction with the homepage, do we still need this PR?
type?: string; | ||
updatedAt?: number; |
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.
nit: It would be nice to maintain the same shape here. Either lets use extraProps
in both places or not.
if (visualizationIdFromUrl) { | ||
chrome.recentlyAccessed.add( | ||
savedVisInstance.savedVis.getFullPath(), | ||
savedVisInstance.savedVis.title, | ||
visualizationIdFromUrl, | ||
{ type: savedVisInstance.savedVis.getOpenSearchType(), updatedAt: Date.now() } | ||
); | ||
} |
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.
why do we need this? without this how does Recently Accessed work?
@@ -51,6 +51,7 @@ export function createSavedVisBuilderVisClass(services: SavedObjectOpenSearchDas | |||
}); | |||
this.showInRecentlyAccessed = true; | |||
this.getFullPath = () => `/app/${PLUGIN_ID}${EDIT_PATH}/${this.id}`; | |||
this.getOpenSearchType = () => VISBUILDER_SAVED_OBJECT; |
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.
Do we need this? I dont see any other saved object doing it this way
link: string, | ||
label: string, | ||
id: string, | ||
extraProps?: { type?: string; updatedAt?: number } |
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.
Is updatedAt needed? Cant we automatically update that value when the add function is called?
@@ -82,6 +82,7 @@ export const useSearch = (services: DiscoverViewServices) => { | |||
core, | |||
toastNotifications, | |||
osdUrlStateStorage, | |||
chrome, |
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.
you arent using this in this file
@ashwin-pc At least the recent items section is still needed. |
@abbyhu2000 is this still 2.16? |
This doesn't target 2.16 anymore. Will close |
Description
This PR implements:
home:useNewHomePage
is toggled on. Mocks are here: [Home Page] Add recently viewed section to home page #6066Start working with data
sectionIssues Resolved
partially resolves #6066
Screenshot
Home page toggle
https://github.com/opensearch-project/OpenSearch-Dashboards/assets/43937633/7b700395-e1cd-4572-b81c-7f24b5aee8fd
New home page without observability plugin
Section styling and links
https://github.com/opensearch-project/OpenSearch-Dashboards/assets/43937633/821d8aa4-e988-4adf-9556-2e05a76eef08
Recent work section
https://github.com/opensearch-project/OpenSearch-Dashboards/assets/43937633/7aeaa20e-8d0a-4284-b5f7-c55dde949d4a
Changelog