Skip to content

Commit

Permalink
Feat (home): Add new theme dashboard screenshots (#4906)
Browse files Browse the repository at this point in the history
* Feat (home): Add new theme dashboard screenshots

- Add `next` theme variant screenshots of sample dashboards with `_new` suffix
- Add chromed screenshots of flights dashboard to use as the images in the new theme modal and replace placeholders
- Tweak gutter size in new theme modal
- Add `hasNewThemeImages` optional boolean to sample dataset registry interface
- Update sample data cards image path logic to fetch themed images if available via `hasNewThemeImages` prop

Signed-off-by: Josh Romero <[email protected]>

* update changelog

Signed-off-by: Josh Romero <[email protected]>

* Minified new theme dashboard screenshots

Signed-off-by: Miki <[email protected]>

---------

Signed-off-by: Josh Romero <[email protected]>
Signed-off-by: Miki <[email protected]>
Co-authored-by: Miki <[email protected]>
(cherry picked from commit f9d3c34)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
  • Loading branch information
github-actions[bot] committed Sep 5, 2023
1 parent fe367eb commit 98679ea
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export const NewThemeModal: FC<Props> = ({ addBasePath, onClose }) => {
services: { application },
} = useOpenSearchDashboards<CoreStart>();

// TODO: Finalize copy
return (
<EuiModal onClose={onClose}>
<EuiModalHeader>
Expand Down Expand Up @@ -71,20 +70,18 @@ export const NewThemeModal: FC<Props> = ({ addBasePath, onClose }) => {
</EuiText>
</RedirectAppLinks>
<EuiSpacer />
<EuiFlexGroup gutterSize="none">
<EuiFlexGroup gutterSize="s">
<EuiFlexItem>
{/* TODO: Replace with actual next theme preview images. Using welcome graphics as placeholders */}
<EuiImage
url={addBasePath('/plugins/home/assets/welcome_graphic_light_2x.png')}
url={addBasePath('/plugins/home/assets/new_theme_light.png')}
alt={i18n.translate('home.newThemeModal.lightModeImageAltDescription', {
defaultMessage: 'screenshot of new theme in light mode',
})}
/>
</EuiFlexItem>
<EuiFlexItem>
{/* TODO: Replace with actual next theme preview images. Using welcome graphics as placeholders */}
<EuiImage
url={addBasePath('/plugins/home/assets/welcome_graphic_dark_2x.png')}
url={addBasePath('/plugins/home/assets/new_theme_dark.png')}
alt={i18n.translate('home.newThemeModal.darkModeImageAltDescription', {
defaultMessage: 'screenshot of new theme in dark mode',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,18 @@ export class SampleDataSetCards extends React.Component {
};

lightOrDarkImage = (sampleDataSet) => {
return getServices().uiSettings.get('theme:darkMode') && sampleDataSet.darkPreviewImagePath
? sampleDataSet.darkPreviewImagePath
: sampleDataSet.previewImagePath;
let imagePath = sampleDataSet.previewImagePath;

if (sampleDataSet.darkPreviewImagePath && getServices().uiSettings.get('theme:darkMode')) {
imagePath = sampleDataSet.darkPreviewImagePath;
}

// For `next` theme, append `_new`
if (sampleDataSet.hasNewThemeImages && getServices().uiSettings.get('theme:version') !== 'v7') {
imagePath = imagePath.replace(/.png/, '_new.png');
}

return imagePath;
};

render() {
Expand Down
Binary file added src/plugins/home/public/assets/new_theme_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const ecommerceSpecProvider = function (): SampleDatasetSchema {
description: ecommerceDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/ecommerce/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const flightsSpecProvider = function (): SampleDatasetSchema {
description: flightsDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/flights/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const logsSpecProvider = function (): SampleDatasetSchema {
description: logsDescription,
previewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard.png',
darkPreviewImagePath: '/plugins/home/assets/sample_data_resources/logs/dashboard_dark.png',
hasNewThemeImages: true,
overviewDashboard: DASHBOARD_ID,
getDataSourceIntegratedDashboard: appendDataSourceId(DASHBOARD_ID),
appLinks: initialAppLinks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export interface SampleDatasetSchema<T = unknown> {
description: string;
previewImagePath: string;
darkPreviewImagePath: string;
hasNewThemeImages?: boolean;

// saved object id of main dashboard for sample data set
overviewDashboard: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const sampleDataSchema = {
description: Joi.string().required(),
previewImagePath: Joi.string().required(),
darkPreviewImagePath: Joi.string(),
hasNewThemeImages: Joi.boolean(),

// saved object id of main dashboard for sample data set
overviewDashboard: Joi.string().required(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const createListRoute = (router: IRouter, sampleDatasets: SampleDatasetSc
description: sampleDataset.description,
previewImagePath: sampleDataset.previewImagePath,
darkPreviewImagePath: sampleDataset.darkPreviewImagePath,
hasNewThemeImages: sampleDataset.hasNewThemeImages,
overviewDashboard: sampleDataset.getDataSourceIntegratedDashboard(dataSourceId),
appLinks: sampleDataset.appLinks,
defaultIndex: sampleDataset.getDataSourceIntegratedDefaultIndex(dataSourceId),
Expand Down

0 comments on commit 98679ea

Please sign in to comment.