-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add per space configuration to custom header banner #94449
add per space configuration to custom header banner #94449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review
@@ -326,6 +326,7 @@ export class Field extends PureComponent<FieldProps> { | |||
<div data-test-subj={`advancedSetting-editField-${name}`}> | |||
<EuiCodeEditor | |||
{...a11yProps} | |||
name={`advancedSetting-editField-${name}-editor`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required for the addition of SettingsPage.setAdvancedSettingsTextArea
(see test/functional/page_objects/settings_page.ts
)
if (this.config.placement !== 'disabled') { | ||
getBannerInfo(http).then( | ||
({ allowed, banner }) => { | ||
if (allowed) { | ||
chrome.setHeaderBanner({ | ||
content: toMountPoint(<Banner bannerConfig={banner} />), | ||
}); | ||
} | ||
}, | ||
() => { | ||
chrome.setHeaderBanner(undefined); | ||
getBannerInfo(http).then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we got uiSettings-based per-space configuration, I had to remove the optimisation that was checking the configuration to see if the global banner was disabled, as it could be enabled for the current space.
'banners:placement': { | ||
name: i18n.translate('xpack.banners.settings.placement.title', { | ||
defaultMessage: 'Banner placement', | ||
}), | ||
category: ['banner'], | ||
order: 1, | ||
type: 'select', | ||
value: config.placement, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trick here is that I'm using the kibana.yml
configuration value as the default value when registering the uiSettings (thanks to the recently added synchronous context.config.get
API)
The main upside is a better user experience, as the value displayed as the default one in the advanced settings app is the 'real' default value that would be effectively used. It's also easier to retrieve the computed config as we only need to query the uiSettings API.
Pinging @elastic/kibana-core (Team:Core) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review only: LGTM!
import { IUiSettingsClient } from 'kibana/server'; | ||
import { ILicense } from '../../../licensing/server'; | ||
import { BannerInfoResponse, BannerConfiguration } from '../../common'; | ||
import { BannerInfoResponse, BannerConfiguration, BannerPlacement } from '../../common'; | ||
import { BannersRouter } from '../types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super-NIT: import type
@@ -9,35 +9,28 @@ import React from 'react'; | |||
import { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from 'src/core/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super-NIT: import type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kibana app changes LGTM, code review only
Woo! Great work @pgayvallet . Some feedback and comments below We should probably engage with @ryankeairns to provide some default colors here that aren't brown. Maybe we can just borrow from EUI templates? I saved a banner and received no notification that it couldn't work due to the license check. I know we discussed adding static text here and it's infinitely more complicated (#94668) to hide / disable the setting or disabling the save button, but I'm going to ask this question any way. Could we provide a toast notification if you save and don't have the appropriate license? It makes for a confusing experience, so anything we can provide here would be great. Upon starting a trial after the fact, the banner is there as expected. General banner related question, should we provide an option during configuration (and I didn't remove the per space banner and added a global config. A refresh persists the old space banner, but if I clear cache and log back in, I'm presented with the new global banner. Two quick things.
Per space switching is looking great Overall, this looks good to me. I think we'll need to pull in @gchaps or someone on her team to help with text. @gchaps for context, we cannot perform a license check for any advanced settings today. Custom banners is a feature that is Gold+ only. So in the short term, we'll need to provide some visibile warning text in the Banner card on the advanced settings page. Is there any chance you might be able to help with the content? |
It was actually @ryankeairns who provided these default values 😄 . But changing them would be trivial if we want to.
You're going to hate the simplicity of the advancedSettings implementation as much as I started to do, but unfortunately this is not going to be possible without changes to the API. There is currently no 'hook' on the client-side to add such logic, and the settings definition are directly and exclusively retrieved from the server...
We talked about it, but in the end I didn't add the 'this setting requires a gold of higher license to be used' description. Do you want me to, given that it's the only think we can really do without any ui/advanced settings improvement?
The markdown component we're using has a Now, do we want to add a configuration option for this, or should we just open all links in new tabs. I feel like the second option would be good enough? I don't see any use case where the user may want to open the link in the current Kibana tab, wdyt?
Hum, can I get more details here? Theoretically, if you initially have a space config and then add a global config after, the space config should still be used when accessing its associated space. Do you mean this wasn't the case? |
Using "top" and "disabled" sounds much better to me. We could then put "top" in the description: Banner placement |
🤦 , worth a shot!
I'd be fine with that, would we assume backwards compatibility in for 7.x with |
I'll add a config deprecation for that to log a warning and replace the value used |
@alexfrancoeur @gchaps Ok, I think we're getting there. The banner section of the advanced settings: And the deprecation message if we used was currently using the I also created #95627 which would unblock adding a description to our categories/sections. PTAL |
Looking good @pgayvallet ! |
UI copy LGTM too! |
@@ -16,7 +16,7 @@ You can configure the `xpack.banners` settings in your `kibana.yml` file. | |||
|=== | |||
|
|||
| `xpack.banners.placement` | |||
| Set to `header` to enable the header banner. Defaults to `disabled`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also need to add documentation about the Banner settings to the Advanced Settings page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. WDYT about 14c33b6?
retest |
|
||
[horizontal] | ||
[[banners-placement]]`banners:placement`:: | ||
Set to `Top` to display a banner above the Elastic header. Defaults to the value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set to `Top` to display a banner above the Elastic header. Defaults to the value of | |
Set to `Top` to display a banner above the Elastic header for this space. Defaults to the value of |
[float] | ||
[[kibana-banners-settings]] | ||
==== Banners | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding: Banners are a subscription feature.
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* restore the banners ui settings * fix banner init logic * fix unit tests * update telemetry schema * add basic server-side plugin tests * add FTR tests for banners plugin * use keyword for sensitive setting * update snapshots * setting name consistency with configuration properties * fix setting names in telemetry files * open banner links in new tab * add config.disableSpaceBanners property * fix types * add descriptions to banner settings * change label and value header->top * finishing header->top replacement * doc nits * add banners section to advanced options doc * feedback on advanced options doc * adapt deprecation to new format # Conflicts: # src/plugins/kibana_usage_collection/server/collectors/management/schema.ts # src/plugins/kibana_usage_collection/server/collectors/management/types.ts # src/plugins/telemetry/schema/oss_plugins.json
👏👏👏👏 |
* restore the banners ui settings * fix banner init logic * fix unit tests * update telemetry schema * add basic server-side plugin tests * add FTR tests for banners plugin * use keyword for sensitive setting * update snapshots * setting name consistency with configuration properties * fix setting names in telemetry files * open banner links in new tab * add config.disableSpaceBanners property * fix types * add descriptions to banner settings * change label and value header->top * finishing header->top replacement * doc nits * add banners section to advanced options doc * feedback on advanced options doc * adapt deprecation to new format # Conflicts: # src/plugins/kibana_usage_collection/server/collectors/management/schema.ts # src/plugins/kibana_usage_collection/server/collectors/management/types.ts # src/plugins/telemetry/schema/oss_plugins.json Co-authored-by: Kibana Machine <[email protected]>
Summary
Phase 2 of #17298
Allow per-space configuration of the header banner
Global versus banner configuration
The global configuration remains unchanged (via the
kibana.yml
configuration file)The per-space configuration is done using the
advanced settings
management section, by editing thebanners:
settings.The config retrieval logic is the following:
Use the global configuration if present, else disable the banner.
Use the space configuration (
uiSettings
) if present, else use the global configuration (kibana.yml
), else disable the banner.Checklist
Release note
It is now possible to add per-space configuration of the header banner from the
banners
plugin.