Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho committed Aug 19, 2024
1 parent 8c4d56e commit 442f525
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 98 deletions.
14 changes: 7 additions & 7 deletions public/apps/configuration/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ const LANDING_PAGE_URL = '/getstarted';
export const ROUTE_MAP: { [key: string]: RouteItem } = {
getStarted: {
name: 'Get Started',
displayNameWithoutSecurityBase: 'Get started with access control',
breadCrumbDisplayNameWithoutSecurityBase: 'Get started with access control',
href: LANDING_PAGE_URL,
},
[ResourceType.roles]: {
name: 'Roles',
displayNameWithoutSecurityBase: 'Roles',
breadCrumbDisplayNameWithoutSecurityBase: 'Roles',
href: buildUrl(ResourceType.roles),
},
[ResourceType.users]: {
name: 'Internal users',
displayNameWithoutSecurityBase: 'Internal users',
breadCrumbDisplayNameWithoutSecurityBase: 'Internal users',
href: buildUrl(ResourceType.users),
},
[ResourceType.permissions]: {
name: 'Permissions',
displayNameWithoutSecurityBase: 'Permissions',
breadCrumbDisplayNameWithoutSecurityBase: 'Permissions',
href: buildUrl(ResourceType.permissions),
},
[ResourceType.tenants]: {
name: 'Tenants',
displayNameWithoutSecurityBase: 'Dashboard multi-tenancy',
breadCrumbDisplayNameWithoutSecurityBase: 'Dashboard multi-tenancy',
href: buildUrl(ResourceType.tenants),
},
[ResourceType.tenantsConfigureTab]: {
Expand All @@ -77,12 +77,12 @@ export const ROUTE_MAP: { [key: string]: RouteItem } = {
},
[ResourceType.auth]: {
name: 'Authentication',
displayNameWithoutSecurityBase: 'Authentication and authorization',
breadCrumbDisplayNameWithoutSecurityBase: 'Authentication and authorization',
href: buildUrl(ResourceType.auth),
},
[ResourceType.auditLogging]: {
name: 'Audit logs',
displayNameWithoutSecurityBase: 'Audit logs',
breadCrumbDisplayNameWithoutSecurityBase: 'Audit logs',
href: buildUrl(ResourceType.auditLogging),
},
};
Expand Down
13 changes: 5 additions & 8 deletions public/apps/configuration/header/header-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ import { flow } from 'lodash';
import { ControlProps, DescriptionProps, HeaderProps } from './header-props';
import { getBreadcrumbs } from '../utils/resource-utils';

// controlType should be one of: https://github.com/AMoo-Miki/OpenSearch-Dashboards/blob/header-collective/src/plugins/navigation/public/top_nav_menu/top_nav_control_data.tsx#L91

export const HeaderButtonOrLink = React.memo((props: ControlProps) => {
export const HeaderButtonOrLink = React.memo((props: HeaderProps & ControlProps) => {
const { HeaderControl } = props.navigation.ui;

return (
<HeaderControl
setMountPoint={props.application.setAppRightControls}
controls={props.controls}
className={props.className}
setMountPoint={props.coreStart.application.setAppRightControls}
controls={props.appRightControls}
/>
);
});
Expand All @@ -51,10 +48,10 @@ export const PageHeader = (props: HeaderProps & DescriptionProps & ControlProps)
controls={props.descriptionControls}
/>
) : null}
{props.controlControls ? (
{props.appRightControls ? (
<HeaderControl
setMountPoint={props.coreStart.application.setAppRightControls}
controls={props.controlControls}
controls={props.appRightControls}
/>
) : null}
</>
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/header/header-props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface HeaderProps {
}

export interface ControlProps {
controlControls?: TopNavControlData[];
appRightControls?: TopNavControlData[];
}

export interface DescriptionProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('PageHeader', () => {
5
);
expect(wrapper.contains(props.fallBackComponent)).toBe(false);
// Verifies that the HeaderControl is called with both controls passed as props
expect(props.navigation.ui.HeaderControl.mock.calls[0][0].controls).toEqual(['control-1']);
expect(props.navigation.ui.HeaderControl.mock.calls[1][0].controls).toEqual(['control-2']);
});
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/auth-view/auth-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function AuthView(props: AppDependencies) {
<PageHeader
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
controlControls={buttonData}
appRightControls={buttonData}
fallBackComponent={
<EuiPageHeader>
<EuiTitle size="l">
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function GetStarted(props: AppDependencies) {
<PageHeader
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
controlControls={buttonData}
appRightControls={buttonData}
fallBackComponent={
<EuiPageHeader>
<EuiTitle size="l">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ export function PermissionList(props: AppDependencies) {
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
descriptionControls={descriptionData}
controlControls={buttonData}
appRightControls={buttonData}
fallBackComponent={
<EuiPageHeader>
<EuiTitle size="l">
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/role-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export function RoleList(props: AppDependencies) {
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
descriptionControls={descriptionData}
controlControls={buttonData}
appRightControls={buttonData}
fallBackComponent={
<EuiPageHeader>
<EuiTitle size="l">
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/role-view/role-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export function RoleView(props: RoleViewProps) {
<PageHeader
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
controlControls={roleView}
appRightControls={roleView}
fallBackComponent={
<>
<EuiPageContentHeader>
Expand Down
8 changes: 5 additions & 3 deletions public/apps/configuration/panels/tenant-list/manage_tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,11 @@ export function ManageTab(props: AppDependencies) {
<EuiFlexItem>{actionsMenu}</EuiFlexItem>
{ useUpdatedUX ?
<HeaderButtonOrLink
navigation={props.depsStart.navigation}
controls={createTenantButton}
application={props.coreStart.application}

navigation={props.depsStart.navigation}
coreStart={props.coreStart}
appRightControls={createTenantButton}

/>
:
<EuiFlexItem>
Expand Down
2 changes: 1 addition & 1 deletion public/apps/configuration/panels/user-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function UserList(props: AppDependencies) {
navigation={props.depsStart.navigation}
coreStart={props.coreStart}
descriptionControls={descriptionData}
controlControls={buttonData}
appRightControls={buttonData}
fallBackComponent={
<EuiPageHeader>
<EuiTitle size="l">
Expand Down
Loading

0 comments on commit 442f525

Please sign in to comment.