-
Notifications
You must be signed in to change notification settings - Fork 871
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
[Workspace] Refactor new home page #8467
base: main
Are you sure you want to change the base?
[Workspace] Refactor new home page #8467
Conversation
Signed-off-by: yubonluo <[email protected]>
…oards into 2.17/support-home-page
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
…oards into 2.17/support-home-page
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
…ch-Dashboards into 2.17/support-home-page
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8467 +/- ##
==========================================
- Coverage 60.95% 60.93% -0.03%
==========================================
Files 3758 3759 +1
Lines 89326 89349 +23
Branches 13974 13981 +7
==========================================
- Hits 54453 54446 -7
- Misses 31481 31501 +20
- Partials 3392 3402 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
Signed-off-by: yubonluo <[email protected]>
@@ -166,6 +166,9 @@ export class HomePublicPlugin | |||
navLinkStatus: AppNavLinkStatus.hidden, | |||
mount: async (params: AppMountParameters) => { | |||
const [coreStart, { navigation }] = await core.getStartServices(); | |||
if (!!coreStart.application.capabilities.workspaces?.enabled) { | |||
coreStart.application.navigateToApp('workspace_initial'); |
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.
coreStart.application.navigateToApp('workspace_initial'); | |
coreStart.application.navigateToApp('workspace_initial'); | |
return ; |
What about we return early here to avoid unnecessary code execution below.
const isDashboardAdmin = !!application.capabilities.dashboards?.isDashboardAdmin; | ||
const availableUseCases = registeredUseCases$ | ||
.getValue() | ||
.filter((item) => !item.systematic || item.id === 'all'); |
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.
.filter((item) => !item.systematic || item.id === 'all'); | |
.filter((item) => !item.systematic || item.id === ALL_USE_CASE_ID); |
Nit: we have the id from core I remember.
</EuiPageBody> | ||
{isUseCaseFlyoutVisible && ( | ||
<WorkspaceUseCaseFlyout |
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.
setSettingMount(items.at(2)); | ||
setDevToolsMount(items.at(3)); | ||
setUserAccountMount(items.at(-1)); |
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.
Can we use id to match instead picking from fixed index?
userAccountMount.mount(mountUserAccountRef.current); | ||
devToolsMount.mount(mountDevToolsRef.current); | ||
settingMount.mount(mountSettingRef.current); |
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.
We should mount the menu in individual if else
. The code won't work if security plugin is not installed.
.filter((item) => !item.systematic || item.id === 'all'); | ||
const workspaceList = workspaces.workspaceList$.getValue(); | ||
const [isUseCaseFlyoutVisible, setIsUseCaseFlyoutVisible] = useState(false); | ||
const [defaultUseCaseId, setDefaultUseCaseId] = useState(availableUseCases[0].id); |
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.
const [defaultUseCaseId, setDefaultUseCaseId] = useState(availableUseCases[0].id); | |
const [defaultExpandedUseCaseId, setDefaultExpandedUseCaseId] = useState(availableUseCases[0].id); |
Nit: defaultUseCaseId seems a little bit confusing.
const [userAccountMount, setUserAccountMount] = useState<ChromeNavControl | undefined>(undefined); | ||
const [settingMount, setSettingMount] = useState<ChromeNavControl | undefined>(undefined); | ||
const [devToolsMount, setDevToolsMount] = useState<ChromeNavControl | undefined>(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.
What about we just use const items = useObservable(chrome.navControls.getLeftBottom$());
and cherry-pick the needed icon to render? the useState seems overwhelming here.
<EuiIcon type="reporter" size="s" color="primary" /> | ||
| ||
<EuiLink | ||
href="https://docs.aws.amazon.com/opensearch-service/latest/developerguide/what-is.html" |
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.
Should it be the doc link related to workspace?
@@ -0,0 +1,80 @@ | |||
/* stylelint-disable */ | |||
.observability { |
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 className may match unexpected elements, can we add some prefix?
/* stylelint-disable */ | ||
.observability { | ||
background-color: hsla(30deg, 24%, 96%, 100%); | ||
background-image: |
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.
Can we move the customized gradient to a file like gradient_variables.scss? So that we only apply the stylelint-disable rule in that file.
.createWorkspaceTextBorder { | ||
border: 1px dashed; | ||
border-radius: 8px; | ||
max-height: 160px; | ||
width: 210px; | ||
padding: 10px; | ||
border-color: $ouiColorDarkShade; | ||
} | ||
|
||
.fixedLeftBottomIcon { | ||
position: fixed; | ||
bottom: 12px; | ||
left: 12px; | ||
} |
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.
Same here, please use a unified prefix for the class.
Description
Refactor new home page.
The new home page will show use case card, workspace list, use case information flyout, create workspace button for OSD admin, view workspace button, tools button, setting button and user information.
Issues Resolved
Screenshot
2024-10-03.15.23.43.mp4
Dark mode
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration