Skip to content
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

New homepage #5613

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
0e4a30d
Layout initial new homepage implementation
BSFishy Dec 14, 2023
1572cac
Add some things I for some reason didn't get in the initial commit
BSFishy Dec 14, 2023
7babcc1
Add formatting line
BSFishy Dec 14, 2023
8a48a5f
Flesh out some more of the homepage implementation
BSFishy Dec 14, 2023
f9183d4
Add doc comment explaining get homepage function
BSFishy Dec 14, 2023
ca0eb55
Remove unused function
BSFishy Dec 14, 2023
76ec36a
Rename functions to more accurately describe what they do
BSFishy Dec 14, 2023
1c00578
WE HAVE RENDERING
BSFishy Dec 15, 2023
c4eea91
Make some fixed/clarifications around the lazy rendering
BSFishy Dec 15, 2023
f87bb41
Add basic layout for hero sections and sections
BSFishy Dec 15, 2023
cb4538c
Set up proper section rendering
BSFishy Dec 15, 2023
35ffb80
Add page layout
BSFishy Dec 15, 2023
6a8ae77
Add homepage saved object edit button
BSFishy Dec 18, 2023
ea5b7e1
Memoize section content
BSFishy Dec 19, 2023
f50aa73
Add data section
BSFishy Dec 19, 2023
c0203d4
Add learn basics section
BSFishy Dec 19, 2023
e192c1a
Small cleanup things
BSFishy Dec 19, 2023
06a18f3
Misc changes
BSFishy Dec 21, 2023
1d45b7c
Remove custom card display
BSFishy Jan 4, 2024
cfe4512
Fix breadcrumbs not updating
BSFishy Jan 4, 2024
2fc43e4
Add small todo comment
BSFishy Jan 4, 2024
afedf5b
Inline section rendering
BSFishy Jan 4, 2024
ad7e3bd
Fix section type service mock
BSFishy Jan 8, 2024
9892fa3
Fix jest tests
BSFishy Jan 8, 2024
950f892
Merge branch 'main' into newest-home
BSFishy Jan 8, 2024
f66827e
Fix the test mocks
BSFishy Jan 8, 2024
c60d61e
Add throw tests
BSFishy Jan 8, 2024
0ffeea4
Remove default hero section
BSFishy Jan 8, 2024
decff05
Add a few more tests
BSFishy Jan 8, 2024
ea10edb
Add footer
BSFishy Jan 9, 2024
b0b9721
Fix some of the testing
BSFishy Jan 9, 2024
dd23069
Add homepage saved object test
BSFishy Jan 9, 2024
86e63b3
Add basic getHomepage test
BSFishy Jan 9, 2024
a91d9aa
Remove copilot comments
BSFishy Jan 9, 2024
70e0ff2
Add some more tests to ensure functionality is as intended
BSFishy Jan 11, 2024
ebaddb6
Remove unused file
BSFishy Jan 11, 2024
c24a44e
Add test subjects
BSFishy Jan 12, 2024
18cfbe0
Update changelog
BSFishy Jan 16, 2024
0626331
Update with guidance from UX
BSFishy Jan 16, 2024
e68b7e0
Convert homepage to use observables
BSFishy Jan 16, 2024
c9b225a
Add doc comment
BSFishy Jan 16, 2024
4d5e2ef
Finish functionality for observable based homepage
BSFishy Jan 17, 2024
e25eecb
Rename heros to heroes
BSFishy Jan 17, 2024
3d5224d
Update footer i18n ids
BSFishy Jan 17, 2024
07948ad
Extract layout into its own component
BSFishy Jan 17, 2024
063a3f7
Make the new home experience configurable
BSFishy Jan 18, 2024
a004be0
Move all legacy home stuff into legacy folder
BSFishy Jan 19, 2024
9f1f88b
Update loading and error designs
BSFishy Jan 22, 2024
e3ccc61
Change from Webpack import to file path
BSFishy Jan 22, 2024
99eedf6
Add config value for disabling new homepage
BSFishy Jan 22, 2024
32844b3
Reverse list
BSFishy Jan 22, 2024
bb7d2e3
Redo some of the comments
BSFishy Jan 22, 2024
fc12da9
Remove old todo comment
BSFishy Jan 22, 2024
ae334f9
Merge branch 'main' into newest-home
BSFishy Jan 22, 2024
40ffea4
Add welcome screen & branding & fix tests
BSFishy Jan 23, 2024
7f33cd4
Make new homepage disabled by default
BSFishy Jan 24, 2024
f839074
Change disable homepage behavior
BSFishy Jan 24, 2024
2b16a10
Change some names around
BSFishy Jan 24, 2024
7899ca5
Add back recently accessed
BSFishy Jan 24, 2024
c2176cd
Reduce weight of ingestion image
BSFishy Jan 24, 2024
14aa57a
Minor comment addressing
BSFishy Jan 25, 2024
9e4554f
Update learn section with UX feedback
BSFishy Jan 25, 2024
018c984
Merge branch 'main' into newest-home
BSFishy Jan 25, 2024
a61ef5d
Small redesign cleanup
BSFishy Jan 25, 2024
cd0da80
Fix useShowWelcome semantics
BSFishy Jan 29, 2024
083eb3f
Actually fix show welcome this time
BSFishy Jan 29, 2024
9e0d5b3
Rename config option
BSFishy Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:

env:
TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
TEST_BRANCH: "${{ 'feature/new-home' || inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is input that can be passed github so i believe we can just remove this. or if we create a feature branch within this repo and call it feature/new-home it will pull automatically.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke to Rocky offline:

This is a trick to make sure merging this PR doesn't impact other PRs while the FTR PR is open and vice versa. Creating a feature branch on FTR and pointing this PR to that, and later PRing the feature branch to FTR:

  1. While this PR is being discussed and updated, the FTR tests are updated too in the feature branch; this PR will pass its tests and so will other PRs that are not pointing to this feature branch.
  2. When this PR is merged, OSD main will continue to look at the feature branch of FTR; tests will pass because all new PRs will be pointing to the feature branch.
  3. When the feature branch of FTR is PRed and merged, the new tests will be in FTR main; OSD tests will continue to point to the feature branch and will continue to pass.
  4. A PR on OSD will reset the default FTR test branch used by the workflow to main; OSD tests will continue to pass since FTR main has the correct tests that were merged in from the feature branch.

This choreography is to make sure we never accept failing tests as a side effect of having new tests added or new functionality added.

FTR_PATH: 'ftr'
START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true'
OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot -E cluster.routing.allocation.disk.threshold_enabled=false'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Discover] Added customizable pagination options based on Discover UI settings [#5610](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5610)
- [Chrome] Introduce registerCollapsibleNavHeader to allow plugins to customize the rendering of nav menu header ([#5244](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5244))
- [Custom Branding] Relative URL should be allowed for logos ([#5572](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5572))
- Implement new homepage ([#5613](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5613))
- [Discover] Enhanced the data source selector with added sorting functionality ([#5609](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/5609))

### 🐛 Bug Fixes
Expand Down
3 changes: 3 additions & 0 deletions config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
# Set the value to true to disable the new theme introduction modal
#home.disableNewThemeModal: false

# Set the value to true to make the next homepage the default. Both homepages will be available regardless of this setting.
#home.preferNextHomePage: false

# Setting for an optimized healthcheck that only uses the local OpenSearch node to do Dashboards healthcheck.
# This settings should be used for large clusters or for clusters with ingest heavy nodes.
# It allows Dashboards to only healthcheck using the local OpenSearch node rather than fan out requests across all nodes.
Expand Down
1 change: 1 addition & 0 deletions src/plugins/home/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { schema, TypeOf } from '@osd/config-schema';
export const configSchema = schema.object({
disableWelcomeScreen: schema.boolean({ defaultValue: false }),
disableNewThemeModal: schema.boolean({ defaultValue: false }),
preferNextHomePage: schema.boolean({ defaultValue: false }),
});

export type ConfigSchema = TypeOf<typeof configSchema>;
6 changes: 2 additions & 4 deletions src/plugins/home/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "opensearchDashboards",
"server": true,
"ui": true,
"requiredPlugins": ["data", "urlForwarding"],
"requiredPlugins": ["data", "urlForwarding", "savedObjects"],
"optionalPlugins": ["usageCollection", "telemetry", "dataSource"],
"requiredBundles": [
"opensearchDashboardsReact", "dataSourceManagement"
]
"requiredBundles": ["opensearchDashboardsReact", "dataSourceManagement"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
@import "synopsis";
@import "welcome";
@import "tutorial/tutorial";
@import "homepage/homepage";
48 changes: 36 additions & 12 deletions src/plugins/home/public/application/components/home_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
import React from 'react';
import { I18nProvider } from '@osd/i18n/react';
import PropTypes from 'prop-types';
import { Home } from './home';
import { Home } from './legacy/home';
import { Homepage } from './homepage';
BSFishy marked this conversation as resolved.
Show resolved Hide resolved
import { FeatureDirectory } from './feature_directory';
import { TutorialDirectory } from './tutorial_directory';
import { Tutorial } from './tutorial/tutorial';
Expand All @@ -56,6 +57,7 @@ export function HomeApp({ directories, solutions }) {
addBasePath,
environmentService,
telemetry,
homeConfig,
} = getServices();
const environment = environmentService.getEnvironment();
const isCloudEnabled = environment.cloud;
Expand Down Expand Up @@ -83,6 +85,20 @@ export function HomeApp({ directories, solutions }) {
);
};

const legacyHome = (
<Home
addBasePath={addBasePath}
directories={directories}
solutions={solutions}
find={savedObjectsClient.find}
localStorage={localStorage}
urlBasePath={getBasePath()}
telemetry={telemetry}
/>
);

const homepage = <Homepage />;

return (
<I18nProvider>
<Router>
Expand All @@ -92,17 +108,25 @@ export function HomeApp({ directories, solutions }) {
<Route exact path="/feature_directory">
<FeatureDirectory addBasePath={addBasePath} directories={directories} />
</Route>
<Route exact path="/">
<Home
addBasePath={addBasePath}
directories={directories}
solutions={solutions}
find={savedObjectsClient.find}
localStorage={localStorage}
urlBasePath={getBasePath()}
telemetry={telemetry}
/>
</Route>
{homeConfig.preferNextHomePage ? (
<>
<Route exact path="/legacy-home">
{legacyHome}
</Route>
<Route exact path="/">
{homepage}
</Route>
</>
) : (
<>
<Route exact path="/next-home">
{homepage}
</Route>
<Route exact path="/">
{legacyHome}
</Route>
</>
)}
<Route path="*" exact={true} component={RedirectToDefaultApp} />
</Switch>
</Router>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.home-homepage-pageBody {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
.home-homepage-pageBody {
.homepagePage {

following BEM

// This is needed to make sure the page body is not wider than the page.
// This is otherwise not possible with the props on EuiPageTemplate.
padding: 0 $euiSizeL;
}

.home-homepage-body--fill {
min-height: $euiSize * 50;
}
105 changes: 105 additions & 0 deletions src/plugins/home/public/application/components/homepage/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';
import { FormattedMessage } from '@osd/i18n/react';
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { CoreStart } from 'opensearch-dashboards/public';
import { HOME_APP_BASE_PATH } from '../../../../common/constants';
import {
RedirectAppLinks,
useOpenSearchDashboards,
useUiSetting$,
} from '../../../../../opensearch_dashboards_react/public';

export const Footer: React.FC = () => {
BSFishy marked this conversation as resolved.
Show resolved Hide resolved
const [defaultRoute, setDefaultRoute] = useUiSetting$<string>('defaultRoute');
const {
services: {
application,
notifications: { toasts },
},
} = useOpenSearchDashboards<CoreStart>();

const getUrlForApp = application.getUrlForApp;
const { show, save } = application.capabilities.advancedSettings ?? {};
Comment on lines +27 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const getUrlForApp = application.getUrlForApp;
const { show, save } = application.capabilities.advancedSettings ?? {};
const { navigateToApp, capabilities } = application;
const { show, save } = capabilities.advancedSettings ?? {};


const isAdvancedSettingsEnabled = show && save;

const defaultRouteButton =
defaultRoute === HOME_APP_BASE_PATH ? (
<RedirectAppLinks application={application}>
<EuiButtonEmpty
flush="both"
href={getUrlForApp('management', { path: 'opensearch-dashboards/settings#defaultRoute' })}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to do this for all links since they are internal links and this is how you trigger SPA routing

Suggested change
href={getUrlForApp('management', { path: 'opensearch-dashboards/settings#defaultRoute' })}
onClick={() => navigateToApp('management', { path: 'opensearch-dashboards/settings#defaultRoute' })}

iconType="home"
size="xs"
>
<FormattedMessage
id="home.footer.changeHomeRouteLink"
defaultMessage="Display a different page on log in"
/>
</EuiButtonEmpty>
</RedirectAppLinks>
) : (
<EuiButtonEmpty
flush="both"
iconType="home"
onClick={() => {
setDefaultRoute(HOME_APP_BASE_PATH);
toasts.addSuccess({
title: i18n.translate('home.footer.changeDefaultRouteSuccessToast', {
defaultMessage: 'Landing page updated',
}),
});
}}
size="xs"
>
<FormattedMessage
id="home.footer.makeDefaultRouteLink"
defaultMessage="Make this my landing page"
/>
</EuiButtonEmpty>
);

return (
<EuiFlexGroup direction="row" wrap>
{isAdvancedSettingsEnabled && <EuiFlexItem grow={false}>{defaultRouteButton}</EuiFlexItem>}

<EuiFlexItem grow={false}>
<RedirectAppLinks application={application}>
<EuiButtonEmpty
flush="both"
href={getUrlForApp('home', { path: '#/feature_directory' })}
iconType="apps"
size="xs"
>
<FormattedMessage
id="home.footer.appDirectoryButtonLabel"
defaultMessage="View app directory"
/>
</EuiButtonEmpty>
</RedirectAppLinks>
</EuiFlexItem>

<EuiFlexItem grow={false}>
<RedirectAppLinks application={application}>
<EuiButtonEmpty
flush="both"
href={getUrlForApp('opensearch_dashboards_overview')}
iconType="visualizeApp"
size="xs"
>
<FormattedMessage
id="home.footer.visualizeAndAnalyze"
defaultMessage="Visualize & Analyze"
/>
</EuiButtonEmpty>
</RedirectAppLinks>
</EuiFlexItem>
</EuiFlexGroup>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React, { FC } from 'react';
import { EuiPanel } from '@elastic/eui';
import { RenderFn } from '../../../services/section_type/section_type';
import { LazyRender } from './lazy_render';

interface Props {
render: RenderFn;
}

export const HeroSection: FC<Props> = ({ render }) => {
return (
<EuiPanel data-test-subj="homepageHeroSection">
<LazyRender render={render} />
</EuiPanel>
);
};
Loading
Loading