-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Advanced Settings] Add tab for global settings (#174301)
Closes #172921 ## Summary This PR adds tabs for Space/Global settings to the new settings application in `packages/kbn-management/settings`. If no global settings exist (as is the case in serverless), the tabs are simply not rendered and only the space settings are displayed. **When global settings exist:** <img width="1641" alt="Screenshot 2024-01-08 at 15 49 21" src="https://github.com/elastic/kibana/assets/59341489/8b78cb13-fc2e-4122-8141-eaa3a7fc2bde"> <img width="1641" alt="Screenshot 2024-01-08 at 15 49 25" src="https://github.com/elastic/kibana/assets/59341489/10fa79dc-4a39-454b-8989-3bb27c849118"> <br><br> **When no global settings exist:** <img width="1641" alt="Screenshot 2024-01-08 at 15 49 47" src="https://github.com/elastic/kibana/assets/59341489/ca40478d-da85-4ff5-8a7b-f4d2e71f1f0a"> ### How to test 1. Testing in Storybook: The Application component can be tested in the [Storybook deployment](https://ci-artifacts.kibana.dev/storybooks/pr-174301/d14d00aa03ffdb3b166ff78161102ac1867074e6/index.html) in this PR. 2. Testing in Serverless: **Verify that the Advanced settings app in serverless is not affected:** Since there are no global settings in serverless (as there are no spaces), these changes shouldn't affect how the Advanced settings app behaves in serverless; that is, there shouldn't be any tabs. **Test the tabs by allowlisting global settings:** It is possible to test the tabs in serverless by allowlisting some of the [global settings in Kibana](https://www.elastic.co/guide/en/kibana/current/advanced-options.html#kibana-custom-branding-settings). For example, add the following setting Id's to the allowlist of common settings in `packages/serverless/settings/common/index.ts`: ``` export const ALL_COMMON_SETTINGS = [ ... ...DISCOVER_SETTINGS, ...NOTIFICATION_SETTINGS, 'xpackCustomBranding:logo', 'xpackCustomBranding:customizedLogo', 'xpackCustomBranding:pageTitle', ]; ``` Then run Es with `yarn es serverless` and Kibana with `yarn serverless-{es/oblt/security}` and verify that the Advanced settings app contains a Global settings tab with the allowlisted global settings above and that it behaves as the original Advanced settings app behaves in stateful Kibana. ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [x] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [x] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
541174a
commit 57fb10d
Showing
34 changed files
with
513 additions
and
121 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
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
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
23 changes: 23 additions & 0 deletions
23
packages/kbn-management/settings/application/hooks/use_scope_fields.ts
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,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { Query } from '@elastic/eui'; | ||
import { FieldDefinition } from '@kbn/management-settings-types'; | ||
import { useFields } from './use_fields'; | ||
|
||
/** | ||
* React hook which retrieves the fields for each scope (`namespace` and `global`) | ||
* and returns two collections of {@link FieldDefinition} objects. | ||
* @param query The {@link Query} to execute for filtering the fields. | ||
* @returns Two arrays of {@link FieldDefinition} objects. | ||
*/ | ||
export const useScopeFields = (query?: Query): [FieldDefinition[], FieldDefinition[]] => { | ||
const spaceFields = useFields('namespace', query); | ||
const globalFields = useFields('global', query); | ||
return [spaceFields, globalFields]; | ||
}; |
Oops, something went wrong.