@@ -75,21 +209,26 @@ exports[`should render a Welcome screen with the telemetry disclaimer when optIn
-
-
-
+
@@ -173,21 +312,26 @@ exports[`should render a Welcome screen with the telemetry disclaimer when optIn
-
-
-
+
diff --git a/src/plugins/home/public/application/components/_welcome.scss b/src/plugins/home/public/application/components/_welcome.scss
index 8cb2539247b2..e429c578a40b 100644
--- a/src/plugins/home/public/application/components/_welcome.scss
+++ b/src/plugins/home/public/application/components/_welcome.scss
@@ -14,6 +14,16 @@
@include euiBottomShadowMedium;
}
+.homWelcome__customLogoContainer {
+ height: 80px;
+ padding: 10px 10px 10px 10px;
+}
+
+.homWelcome__customLogo{
+ height: 100%;
+ max-width: 100%;
+}
+
.homWelcome__footerAction {
margin-right: $euiSizeS;
}
diff --git a/src/plugins/home/public/application/components/home.js b/src/plugins/home/public/application/components/home.js
index 52259cd6a6f0..ff670edbb3c6 100644
--- a/src/plugins/home/public/application/components/home.js
+++ b/src/plugins/home/public/application/components/home.js
@@ -201,13 +201,13 @@ export class Home extends Component {
onSkip={this.skipWelcome}
urlBasePath={this.props.urlBasePath}
telemetry={this.props.telemetry}
+ branding={getServices().injectedMetadata.getBranding()}
/>
);
}
render() {
const { isLoading, isWelcomeEnabled, isNewOpenSearchDashboardsInstance } = this.state;
-
if (isWelcomeEnabled) {
if (isLoading) {
return this.renderLoading();
diff --git a/src/plugins/home/public/application/components/home.test.js b/src/plugins/home/public/application/components/home.test.js
index 5c0de0365d6c..072e21eff9bd 100644
--- a/src/plugins/home/public/application/components/home.test.js
+++ b/src/plugins/home/public/application/components/home.test.js
@@ -45,6 +45,9 @@ jest.mock('../opensearch_dashboards_services', () => ({
chrome: {
setBreadcrumbs: () => {},
},
+ injectedMetadata: {
+ getBranding: () => ({}),
+ },
}),
}));
diff --git a/src/plugins/home/public/application/components/welcome.test.tsx b/src/plugins/home/public/application/components/welcome.test.tsx
index d047746ca9cf..cc83a2ca6deb 100644
--- a/src/plugins/home/public/application/components/welcome.test.tsx
+++ b/src/plugins/home/public/application/components/welcome.test.tsx
@@ -49,10 +49,19 @@ test('should render a Welcome screen with the telemetry disclaimer', () => {
expect(component).toMatchSnapshot();
});
*/
+
+const branding = {
+ logoUrl: '/',
+ smallLogoUrl: '/',
+ title: 'OpenSearch Dashboards',
+};
+
test('should render a Welcome screen with the telemetry disclaimer when optIn is true', () => {
const telemetry = telemetryPluginMock.createStartContract();
telemetry.telemetryService.getIsOptedIn = jest.fn().mockReturnValue(true);
- const component = shallow( {}} telemetry={telemetry} />);
+ const component = shallow(
+ {}} telemetry={telemetry} branding={branding} />
+ );
expect(component).toMatchSnapshot();
});
@@ -60,13 +69,15 @@ test('should render a Welcome screen with the telemetry disclaimer when optIn is
test('should render a Welcome screen with the telemetry disclaimer when optIn is false', () => {
const telemetry = telemetryPluginMock.createStartContract();
telemetry.telemetryService.getIsOptedIn = jest.fn().mockReturnValue(false);
- const component = shallow( {}} telemetry={telemetry} />);
+ const component = shallow(
+ {}} telemetry={telemetry} branding={branding} />
+ );
expect(component).toMatchSnapshot();
});
test('should render a Welcome screen with no telemetry disclaimer', () => {
- const component = shallow( {}} />);
+ const component = shallow( {}} branding={branding} />);
expect(component).toMatchSnapshot();
});
@@ -75,7 +86,31 @@ test('fires opt-in seen when mounted', () => {
const telemetry = telemetryPluginMock.createStartContract();
const mockSetOptedInNoticeSeen = jest.fn();
telemetry.telemetryNotifications.setOptedInNoticeSeen = mockSetOptedInNoticeSeen;
- shallow( {}} telemetry={telemetry} />);
+ shallow( {}} telemetry={telemetry} branding={branding} />);
expect(mockSetOptedInNoticeSeen).toHaveBeenCalled();
});
+
+test('should render a Welcome screen with the default OpenSearch Dashboards branding', () => {
+ const defaultBranding = {
+ logoUrl: '/',
+ smallLogoUrl: '',
+ title: 'OpenSearch Dashboards',
+ };
+ const component = shallow(
+ {}} branding={defaultBranding} />
+ );
+ expect(component).toMatchSnapshot();
+});
+
+test('should render a Welcome screen with customized branding', () => {
+ const customBranding = {
+ logoUrl: '/',
+ smallLogoUrl: '/custom',
+ title: 'custom title',
+ };
+ const component = shallow(
+ {}} branding={customBranding} />
+ );
+ expect(component).toMatchSnapshot();
+});
diff --git a/src/plugins/home/public/application/components/welcome.tsx b/src/plugins/home/public/application/components/welcome.tsx
index 336414be130f..3747c89b1ca6 100644
--- a/src/plugins/home/public/application/components/welcome.tsx
+++ b/src/plugins/home/public/application/components/welcome.tsx
@@ -58,6 +58,11 @@ interface Props {
urlBasePath: string;
onSkip: () => void;
telemetry?: TelemetryPluginStart;
+ branding: {
+ logoUrl: string;
+ smallLogoUrl: string;
+ title: string;
+ };
}
/**
@@ -141,19 +146,39 @@ export class Welcome extends React.Component {
};
render() {
- const { urlBasePath, telemetry } = this.props;
+ const { urlBasePath, telemetry, branding } = this.props;
return (
-
-
-
-
+ {branding.smallLogoUrl === '' ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
-
+
diff --git a/src/plugins/home/public/application/opensearch_dashboards_services.ts b/src/plugins/home/public/application/opensearch_dashboards_services.ts
index a5b9fe616a24..b6bb4728726d 100644
--- a/src/plugins/home/public/application/opensearch_dashboards_services.ts
+++ b/src/plugins/home/public/application/opensearch_dashboards_services.ts
@@ -68,6 +68,14 @@ export interface HomeOpenSearchDashboardsServices {
environmentService: EnvironmentService;
telemetry?: TelemetryPluginStart;
tutorialService: TutorialService;
+ injectedMetadata: {
+ getInjectedVar: (name: string, defaultValue?: any) => unknown;
+ getBranding: () => {
+ logoUrl: string;
+ smallLogoUrl: string;
+ title: string;
+ };
+ };
}
let services: HomeOpenSearchDashboardsServices | null = null;
diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts
index eef92ea8ec99..c0ef1c2b56ff 100644
--- a/src/plugins/home/public/plugin.ts
+++ b/src/plugins/home/public/plugin.ts
@@ -119,6 +119,7 @@ export class HomePublicPlugin
homeConfig: this.initializerContext.config.get(),
tutorialService: this.tutorialService,
featureCatalogue: this.featuresCatalogueRegistry,
+ injectedMetadata: coreStart.injectedMetadata,
});
coreStart.chrome.docTitle.change(
i18n.translate('home.pageTitle', { defaultMessage: 'Home' })
diff --git a/test/common/config.js b/test/common/config.js
index be5baaa5d055..05432914a95b 100644
--- a/test/common/config.js
+++ b/test/common/config.js
@@ -60,7 +60,7 @@ export default function () {
`--opensearch.hosts=${formatUrl(servers.opensearch)}`,
`--opensearch.username=${opensearchDashboardsServerTestUser.username}`,
`--opensearch.password=${opensearchDashboardsServerTestUser.password}`,
- `--home.disableWelcomeScreen=true`,
+ `--home.disableWelcomeScreen=false`,
// Needed for async search functional tests to introduce a delay
`--data.search.aggs.shardDelay.enabled=true`,
//`--security.showInsecureClusterWarning=false`,
@@ -76,6 +76,8 @@ export default function () {
// `--newsfeed.service.pathTemplate=/api/_newsfeed-FTS-external-service-simulators/opensearch-dashboards/v{VERSION}.json`,
// Custom branding config
`--opensearchDashboards.branding.logoUrl=https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_darkmode.svg`,
+ `--opensearchDashboards.branding.smallLogoUrl=https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_darkmode.svg`,
+ `--opensearchDashboards.branding.title=OpenSearch`,
],
},
services,
diff --git a/test/functional/apps/visualize/_custom_branding.js b/test/functional/apps/visualize/_custom_branding.js
index b783a3e5acab..7b9d8894edcf 100644
--- a/test/functional/apps/visualize/_custom_branding.js
+++ b/test/functional/apps/visualize/_custom_branding.js
@@ -30,29 +30,75 @@
* GitHub history for details.
*/
import expect from '@osd/expect';
+import { UI_SETTINGS } from '../../../../src/plugins/data/common';
export default function ({ getService, getPageObjects }) {
const browser = getService('browser');
const globalNav = getService('globalNav');
+ const opensearchArchiver = getService('opensearchArchiver');
+ const opensearchDashboardsServer = getService('opensearchDashboardsServer');
const PageObjects = getPageObjects(['common', 'home', 'header']);
+ const testSubjects = getService('testSubjects');
- describe('OpenSearch Dashboards branding configuration', function customLogo() {
- this.tags('includeFirefox');
- const expectedUrl = 'https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_darkmode.svg';
- before(async function () {
- await PageObjects.common.navigateToApp('home');
+ describe('OpenSearch Dashboards branding configuration', function customHomeBranding() {
+ describe('should render welcome page', async () => {
+ this.tags('includeFirefox');
+ const expectedWelcomeLogo =
+ 'https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_darkmode.svg';
+ const expectedWelcomeMessage = 'Welcome to OpenSearch';
+ before(async function () {
+ await opensearchArchiver.unload('logstash_functional');
+ await opensearchArchiver.unload('long_window_logstash');
+ await opensearchArchiver.unload('visualize');
+ await PageObjects.common.navigateToApp('home');
+ });
+ after(async function () {
+ await browser.setWindowSize(1280, 800);
+ await opensearchArchiver.loadIfNeeded('logstash_functional');
+ await opensearchArchiver.loadIfNeeded('long_window_logstash');
+ await opensearchArchiver.load('visualize');
+ await opensearchDashboardsServer.uiSettings.replace({
+ defaultIndex: 'logstash-*',
+ [UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b',
+ });
+ });
+ it('with customized logo', async () => {
+ await testSubjects.existOrFail('welcomeCustomLogo');
+ const actualLabel = await testSubjects.getAttribute(
+ 'welcomeCustomLogo',
+ 'data-test-image-url'
+ );
+ expect(actualLabel.toUpperCase()).to.equal(expectedWelcomeLogo.toUpperCase());
+ });
+ it('with customized title', async () => {
+ await testSubjects.existOrFail('welcomeCustomTitle');
+ const actualLabel = await testSubjects.getAttribute(
+ 'welcomeCustomTitle',
+ 'data-test-title-message'
+ );
+ expect(actualLabel.toUpperCase()).to.equal(expectedWelcomeMessage.toUpperCase());
+ });
});
- it('should show customized logo in Navbar on the main page', async () => {
- await globalNav.logoExistsOrFail(expectedUrl);
- });
+ describe('should render home page', async () => {
+ this.tags('includeFirefox');
+ const expectedUrl =
+ 'https://opensearch.org/assets/brand/SVG/Logo/opensearch_logo_darkmode.svg';
+ before(async function () {
+ await PageObjects.common.navigateToApp('home');
+ });
+
+ it('should show customized logo in Navbar for home page', async () => {
+ await globalNav.logoExistsOrFail(expectedUrl);
+ });
- it('should show a customized logo that can take to home page', async () => {
- await PageObjects.common.navigateToApp('settings');
- await globalNav.clickLogo();
- await PageObjects.header.waitUntilLoadingHasFinished();
- const url = await browser.getCurrentUrl();
- expect(url.includes('/app/home')).to.be(true);
+ it('should show a customized logo that can take back to home page', async () => {
+ await PageObjects.common.navigateToApp('settings');
+ await globalNav.clickLogo();
+ await PageObjects.header.waitUntilLoadingHasFinished();
+ const url = await browser.getCurrentUrl();
+ expect(url.includes('/app/home')).to.be(true);
+ });
});
});
}
diff --git a/test/functional/page_objects/common_page.ts b/test/functional/page_objects/common_page.ts
index d6a018c96b50..84adae2509e7 100644
--- a/test/functional/page_objects/common_page.ts
+++ b/test/functional/page_objects/common_page.ts
@@ -68,8 +68,7 @@ export function CommonPageProvider({ getService, getPageObjects }: FtrProviderCo
// Disable the welcome screen. This is relevant for environments
// which don't allow to use the yml setting, e.g. cloud production.
// It is done here so it applies to logins but also to a login re-use.
- await browser.setLocalStorageItem('home:welcome:show', 'false');
-
+ await browser.setLocalStorageItem('home:welcome:show', 'true');
let currentUrl = await browser.getCurrentUrl();
log.debug(`currentUrl = ${currentUrl}\n appUrl = ${appUrl}`);
await testSubjects.find('opensearchDashboardsChrome', 6 * defaultFindTimeout); // 60 sec waiting