-
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.
Adds page headers for updated UX (#2083)
* Adds initial commit to add header components and modifies get started and user list pages Signed-off-by: Darshit Chanpura <[email protected]> * Updates auth-view page Signed-off-by: Darshit Chanpura <[email protected]> * Updates user edit and create pages Signed-off-by: Darshit Chanpura <[email protected]> * Updates user permissions page Signed-off-by: Darshit Chanpura <[email protected]> * Updates dashboards tenancy page Signed-off-by: Darshit Chanpura <[email protected]> * Updates dashboards audit logs page Signed-off-by: Darshit Chanpura <[email protected]> * Updates roles and related pages Signed-off-by: Darshit Chanpura <[email protected]> * Updates variable name and fixes indentation Signed-off-by: Darshit Chanpura <[email protected]> * Push logic into new component Signed-off-by: Derek Ho <[email protected]> * Lint Signed-off-by: Derek Ho <[email protected]> * Migrate audit logging and tenant tabs to new page header Signed-off-by: Derek Ho <[email protected]> * Migrate all tabs to new component Signed-off-by: Derek Ho <[email protected]> * Remove prop and fix some test failures Signed-off-by: Derek Ho <[email protected]> * fix most tests Signed-off-by: Derek Ho <[email protected]> * Fix existing tests Signed-off-by: Derek Ho <[email protected]> * Push breadcrumb population into child components Signed-off-by: Derek Ho <[email protected]> * Migrate breadcrumbs into the page header component for the top level of all pages Signed-off-by: Derek Ho <[email protected]> * Lint Signed-off-by: Derek Ho <[email protected]> * Update all instances of breadcrumbs to new component and all existing tests pass Signed-off-by: Derek Ho <[email protected]> * Fixes target _blank redirects Signed-off-by: Darshit Chanpura <[email protected]> * Fixes unit tests Signed-off-by: Darshit Chanpura <[email protected]> * Add tests for new component and breadcrumb function Signed-off-by: Derek Ho <[email protected]> * Address PR feedback Signed-off-by: Derek Ho <[email protected]> * Update tests and snapshots Signed-off-by: Derek Ho <[email protected]> --------- Signed-off-by: Darshit Chanpura <[email protected]> Signed-off-by: Derek Ho <[email protected]> Co-authored-by: Derek Ho <[email protected]>
- Loading branch information
1 parent
e3da9b4
commit dc79df3
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.