Skip to content

Commit

Permalink
Add kibana.yml configuration for cases (#100583)
Browse files Browse the repository at this point in the history
Make it so `xpack.observability.unsafe.alertingExperience.enabled` only shows and hides the Alerts page, and `xpack.observability.unsafe.cases.enabled` show and hides the Cases page.
  • Loading branch information
smith committed May 27, 2021
1 parent 806566c commit 7fc4a1f
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ kibana_vars=(
xpack.maps.showMapVisualizationTypes
xpack.ml.enabled
xpack.observability.unsafe.alertingExperience.enabled
xpack.observability.unsafe.cases.enabled
xpack.reporting.capture.browser.autoDownload
xpack.reporting.capture.browser.chromium.disableSandbox
xpack.reporting.capture.browser.chromium.inspect
Expand Down
12 changes: 10 additions & 2 deletions x-pack/plugins/observability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ case management.

If you have:

```yaml
xpack.observability.unsafe.cases.enabled: true
```

In your Kibana configuration, the Cases page will be available.

If you have:

```yaml
xpack.observability.unsafe.alertingExperience.enabled: true
```

In your Kibana configuration, the Alerts and Cases pages will be available.
In your Kibana configuration, the Alerts page will be available.

This will only enable the UI for these pages. In order to have alert data indexed
This will only enable the UI for this page when. In order to have alert data indexed
you'll need to enable writing in the [Rule Registry plugin](../rule_registry/README.md):

```yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('renderApp', () => {
uiSettings: { get: () => false },
http: { basePath: { prepend: (path: string) => path } },
} as unknown) as CoreStart;
const config = { unsafe: { alertingExperience: { enabled: true } } };
const config = { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } };
const params = ({
element: window.document.createElement('div'),
history: createMemoryHistory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('APMSection', () => {
http: { basePath: { prepend: jest.fn() } },
} as unknown) as CoreStart,
appMountParameters: {} as AppMountParameters,
config: { unsafe: { alertingExperience: { enabled: true } } },
config: { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } },
observabilityRuleTypeRegistry: createObservabilityRuleTypeRegistryMock(),
plugins: ({
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('UXSection', () => {
http: { basePath: { prepend: jest.fn() } },
} as unknown) as CoreStart,
appMountParameters: {} as AppMountParameters,
config: { unsafe: { alertingExperience: { enabled: true } } },
config: { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } },
plugins: ({
data: {
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('useTimeRange', () => {
jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({
core: {} as CoreStart,
appMountParameters: {} as AppMountParameters,
config: { unsafe: { alertingExperience: { enabled: true } } },
config: { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } },
plugins: ({
data: {
query: {
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('useTimeRange', () => {
jest.spyOn(pluginContext, 'usePluginContext').mockImplementation(() => ({
core: {} as CoreStart,
appMountParameters: {} as AppMountParameters,
config: { unsafe: { alertingExperience: { enabled: true } } },
config: { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } },
plugins: ({
data: {
query: {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type {
export { enableInspectEsQueries } from '../common/ui_settings_keys';

export interface ConfigSchema {
unsafe: { alertingExperience: { enabled: boolean } };
unsafe: { alertingExperience: { enabled: boolean }; cases: { enabled: boolean } };
}

export const plugin: PluginInitializer<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const withCore = makeDecorator({
appMountParameters: ({
setHeaderActionMenu: () => {},
} as unknown) as AppMountParameters,
config: { unsafe: { alertingExperience: { enabled: true } } },
config: { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } },
core: options as CoreStart,
plugins: ({
data: {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/observability/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ export class Plugin
mount,
updater$,
});
}

if (config.unsafe.cases.enabled) {
coreSetup.application.register({
id: 'observability-cases',
title: 'Cases',
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/observability/public/utils/test_helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const core = ({
},
} as unknown) as CoreStart;

const config = { unsafe: { alertingExperience: { enabled: true } } };
const config = { unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } } };

const plugins = ({
data: { query: { timefilter: { timefilter: { setTime: jest.fn() } } } },
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/observability/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export * from './types';

export const config = {
exposeToBrowser: {
unsafe: { alertingExperience: { enabled: true } },
unsafe: { alertingExperience: { enabled: true }, cases: { enabled: true } },
},
schema: schema.object({
enabled: schema.boolean({ defaultValue: true }),
Expand All @@ -27,6 +27,7 @@ export const config = {
}),
unsafe: schema.object({
alertingExperience: schema.object({ enabled: schema.boolean({ defaultValue: false }) }),
cases: schema.object({ enabled: schema.boolean({ defaultValue: false }) }),
}),
}),
};
Expand Down

0 comments on commit 7fc4a1f

Please sign in to comment.