[Logs UI] Redirect Logs UI to Discover when in serverless mode (#154145)

## 📓 Summary

Closes #153890

The implementation creates a new LogsApp service where we should keep
any logic concerned with what `target_app` parameter is configured and
the actions related to a specific configuration. I thought it could be a
good approach to avoid drilling down the global config till we need it
and keep it cleaner by injecting only the service with predefined
actions.

In this first case, we create a redirect to discover using its locator,
and the exposed method can be used anywhere across the app for
triggering the redirect.

## 🧪 Testing

### Normal behaviour

When Kibana is used as always, we want to keep the current behaviour and
the user will stay on the Logs UI pages.
- Launch the Kibana dev environment with `yarn start`
- Navigate to Logs UI
- Verify the navigation works normally and that no redirect to Discover
occurs

### Serverless behaviour

When Kibana is used in serverless mode, we want to redirect any user
landing to Logs UI to the Discover page, configuring the same data view
or creating an ad-hoc one starting from the index pattern
- Launch the Kibana dev environment with `yarn serverless-oblt`
- Navigate to Logs UI
- Verify to be redirected to Discover and a temporary data view is
created from the current index pattern

---------

Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Marco Antonio Ghiani 2023-04-19 17:30:45 +02:00 committed by GitHub
parent 6d8d1708fe
commit b40b89e711
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 203 additions and 51 deletions

View file

@ -6,6 +6,7 @@
*/
import { SavedObject } from '@kbn/core/server';
import { InfraConfig } from '../../types';
import { infraSourceConfigurationSavedObjectName } from './saved_object_type';
import { InfraSources } from './sources';
@ -108,7 +109,7 @@ describe('the InfraSources lib', () => {
});
});
const createMockStaticConfiguration = (sources: any) => ({
const createMockStaticConfiguration = (sources: any): InfraConfig => ({
alerting: {
inventory_threshold: {
group_by_page_size: 10000,
@ -117,10 +118,12 @@ const createMockStaticConfiguration = (sources: any) => ({
group_by_page_size: 10000,
},
},
enabled: true,
inventory: {
compositeSize: 2000,
},
logs: {
app_target: 'logs-ui',
},
sources,
});