Skip to content

Commit

Permalink
[UX] Change name of expanded header config (#1802) (#1803)
Browse files Browse the repository at this point in the history
`useExpandedHeader` instead of `useExpandedMenu`

fixes #1583

Signed-off-by: Josh Romero <rmerqg@amazon.com>
(cherry picked from commit 6ad5d08)

Co-authored-by: Josh Romero <rmerqg@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and joshuarrrr committed Jun 25, 2022
1 parent f0446b8 commit a4d1cb1
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
# darkModeUrl: ""
# faviconUrl: ""
# applicationTitle: ""
# useExpandedMenu: false
# useExpandedHeader: false

# Set the value of this setting to true to capture region blocked warnings and errors
# for your map rendering services.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/public/chrome/ui/header/header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe('Header', () => {
logo: { defaultUrl: '/foo' },
mark: { defaultUrl: '/foo' },
applicationTitle: 'Foobar Dashboards',
useExpandedMenu: false,
useExpandedHeader: false,
};
const props = {
...mockProps(),
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ export function Header({
const toggleCollapsibleNavRef = createRef<HTMLButtonElement & { euiAnimate: () => void }>();
const navId = htmlIdGenerator()();
const className = classnames('hide-for-sharing', 'headerGlobalNav');
const { useExpandedMenu = true } = branding;
const { useExpandedHeader = true } = branding;

return (
<>
<header className={className} data-test-subj="headerGlobalNav">
<div id="globalHeaderBars">
{useExpandedMenu && (
{useExpandedHeader && (
<EuiHeader
className="expandedHeader"
theme="dark"
Expand Down
14 changes: 7 additions & 7 deletions src/core/public/chrome/ui/header/home_icon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Home button icon ', () => {
mark: {},
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -35,7 +35,7 @@ describe('Home button icon ', () => {
mark: {},
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -51,7 +51,7 @@ describe('Home button icon ', () => {
mark: { defaultUrl: '/defaultModeMark' },
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -69,7 +69,7 @@ describe('Home button icon ', () => {
mark: {},
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -85,7 +85,7 @@ describe('Home button icon ', () => {
mark: {},
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -101,7 +101,7 @@ describe('Home button icon ', () => {
mark: { defaultUrl: '/defaultModeMark' },
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand All @@ -117,7 +117,7 @@ describe('Home button icon ', () => {
mark: { defaultUrl: '/defaultModeMark', darkModeUrl: '/darkModeMark' },
applicationTitle: 'custom title',
assetFolderUrl: 'base/ui/default_branding',
useExpandedMenu: false,
useExpandedHeader: false,
};
const component = mountWithIntl(<HomeIcon {...branding} />);
const icon = component.find('EuiIcon');
Expand Down
6 changes: 3 additions & 3 deletions src/core/public/chrome/ui/header/home_icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const HomeIcon = ({
assetFolderUrl = '',
mark,
applicationTitle = 'opensearch dashboards',
useExpandedMenu = true,
useExpandedHeader = true,
}: ChromeBranding) => {
const { defaultUrl: markUrl, darkModeUrl: darkMarkUrl } = mark ?? {};

Expand All @@ -31,10 +31,10 @@ export const HomeIcon = ({
const getIconProps = () => {
const iconType = customMark
? customMark
: useExpandedMenu
: useExpandedHeader
? 'home'
: `${assetFolderUrl}/${defaultMark}`;
const testSubj = customMark ? 'customMark' : useExpandedMenu ? 'homeIcon' : 'defaultMark';
const testSubj = customMark ? 'customMark' : useExpandedHeader ? 'homeIcon' : 'defaultMark';
const title = `${applicationTitle} home`;
// marks look better at the large size, but the home icon should be medium to fit in with other icons
const size = iconType === 'home' ? ('m' as const) : ('l' as const);
Expand Down
4 changes: 2 additions & 2 deletions src/core/public/core_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ export class CoreSystem {

await this.plugins.start(core);

const { useExpandedMenu = true } = injectedMetadata.getBranding() ?? {};
const { useExpandedHeader = true } = injectedMetadata.getBranding() ?? {};

// ensure the rootDomElement is empty
this.rootDomElement.textContent = '';
this.rootDomElement.classList.add('coreSystemRootDomElement');
if (useExpandedMenu) {
if (useExpandedHeader) {
this.rootDomElement.classList.add('headerIsExpanded');
}
this.rootDomElement.appendChild(coreUiTargetDomElement);
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/opensearch_dashboards_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const config = {
applicationTitle: schema.string({
defaultValue: '',
}),
useExpandedMenu: schema.boolean({
useExpandedHeader: schema.boolean({
defaultValue: true,
}),
}),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/core/server/rendering/rendering_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class RenderingService {
},
faviconUrl: brandingAssignment.favicon,
applicationTitle: brandingAssignment.applicationTitle,
useExpandedMenu: brandingAssignment.useExpandedMenu,
useExpandedHeader: brandingAssignment.useExpandedHeader,
},
},
};
Expand Down Expand Up @@ -270,7 +270,7 @@ export class RenderingService {
: DEFAULT_TITLE;

// use expanded menu by default unless explicitly set to false
const { useExpandedMenu = true } = branding;
const { useExpandedHeader = true } = branding;

const brandingAssignment: BrandingAssignment = {
logoDefault,
Expand All @@ -281,7 +281,7 @@ export class RenderingService {
loadingLogoDarkmode,
favicon,
applicationTitle,
useExpandedMenu,
useExpandedHeader,
};

return brandingAssignment;
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/rendering/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ export interface BrandingAssignment {
loadingLogoDarkmode?: string;
favicon?: string;
applicationTitle?: string;
useExpandedMenu?: boolean;
useExpandedHeader?: boolean;
}
2 changes: 1 addition & 1 deletion src/core/types/custom_branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ export interface Branding {
/** Application title that will replace the default opensearch dashboard string */
applicationTitle?: string;
/** Whether to use expanded menu (true) or condensed menu (false) */
useExpandedMenu?: boolean;
useExpandedHeader?: boolean;
}
2 changes: 1 addition & 1 deletion src/legacy/server/config/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export default () =>
}),
faviconUrl: Joi.any().default('/'),
applicationTitle: Joi.any().default(''),
useExpandedMenu: Joi.boolean().default(true),
useExpandedHeader: Joi.boolean().default(true),
}),
}).default(),

Expand Down

0 comments on commit a4d1cb1

Please sign in to comment.