-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Adds initial commit to add header components and modifies get started and user list pages * Updates auth-view page * Updates user edit and create pages * Updates user permissions page * Updates dashboards tenancy page * Updates dashboards audit logs page * Updates roles and related pages * Updates variable name and fixes indentation * Push logic into new component * Lint * Migrate audit logging and tenant tabs to new page header * Migrate all tabs to new component * Remove prop and fix some test failures * fix most tests * Fix existing tests * Push breadcrumb population into child components * Migrate breadcrumbs into the page header component for the top level of all pages * Lint * Update all instances of breadcrumbs to new component and all existing tests pass * Fixes target _blank redirects * Fixes unit tests * Add tests for new component and breadcrumb function * Address PR feedback * Update tests and snapshots --------- (cherry picked from commit dc79df3) Signed-off-by: Darshit Chanpura <[email protected]> Signed-off-by: Derek Ho <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]>
- Loading branch information
1 parent
80976be
commit e78ba0d
Showing
43 changed files
with
1,899 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { flow } from 'lodash'; | ||
import { ControlProps, DescriptionProps, HeaderProps } from './header-props'; | ||
import { getBreadcrumbs } from '../utils/resource-utils'; | ||
|
||
export const HeaderButtonOrLink = React.memo((props: HeaderProps & ControlProps) => { | ||
const { HeaderControl } = props.navigation.ui; | ||
|
||
return ( | ||
<HeaderControl | ||
setMountPoint={props.coreStart.application.setAppRightControls} | ||
controls={props.appRightControls} | ||
/> | ||
); | ||
}); | ||
|
||
export const PageHeader = (props: HeaderProps & DescriptionProps & ControlProps) => { | ||
const { HeaderControl } = props.navigation.ui; // need to get this from SecurityPluginStartDependencies | ||
const useNewUx = props.coreStart.uiSettings.get('home:useNewHomePage'); | ||
flow(getBreadcrumbs, props.coreStart.chrome.setBreadcrumbs)( | ||
!useNewUx, | ||
props.resourceType, | ||
props.pageTitle, | ||
props.subAction, | ||
props.count | ||
); | ||
if (useNewUx) { | ||
return ( | ||
<> | ||
{props.descriptionControls ? ( | ||
<HeaderControl | ||
setMountPoint={props.coreStart.application.setAppDescriptionControls} | ||
controls={props.descriptionControls} | ||
/> | ||
) : null} | ||
{props.appRightControls ? ( | ||
<HeaderControl | ||
setMountPoint={props.coreStart.application.setAppRightControls} | ||
controls={props.appRightControls} | ||
/> | ||
) : null} | ||
</> | ||
); | ||
} else { | ||
return props.fallBackComponent; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import { CoreStart } from 'opensearch-dashboards/public'; | ||
import { NavigationPublicPluginStart } from 'src/plugins/navigation/public'; | ||
import { TopNavControlData } from 'src/plugins/navigation/public/top_nav_menu/top_nav_control_data'; | ||
import { ResourceType } from '../../../../common'; | ||
|
||
export interface HeaderProps { | ||
navigation: NavigationPublicPluginStart; | ||
coreStart: CoreStart; | ||
fallBackComponent: JSX.Element; | ||
resourceType?: ResourceType; | ||
pageTitle?: string; | ||
subAction?: string; | ||
count?: number; | ||
} | ||
|
||
export interface ControlProps { | ||
appRightControls?: TopNavControlData[]; | ||
} | ||
|
||
export interface DescriptionProps { | ||
descriptionControls?: TopNavControlData[]; | ||
} |
Oops, something went wrong.