kibana/packages/kbn-discover-utils/index.ts
Julia Rechkunova 811a23830b
[OneDiscover] Contextual App Menu Extension Point (#195448)
- Closes https://github.com/elastic/kibana/issues/194269

## Summary

This PR introduces a new extension point `getAppMenu` which allows to:
- add custom App Menu items (as a button or a submenu with more actions)
- extend Alerts menu item with more custom actions

Additionally, this PR rearranges the existing Discover menu items. The
primary actions are rendered as an icon only now.

![Oct-16-2024
17-43-29](https://github.com/user-attachments/assets/dbb67513-05bb-43a4-bd7b-cf958c58a167)


The example usage of the new extension point can be found in
e7964f08e3/src/plugins/discover/public/context_awareness/profile_providers/example/example_data_source_profile/profile.tsx (L81-L168)

### For testing with the example profile

1. Add `discover.experimental.enabledProfiles: ['example-root-profile',
'example-data-source-profile', 'example-document-profile']` to
`kibana.dev.yml`
2. Run the following in DevTools
```
POST _aliases
{
  "actions": [
    {
      "add": {
        "index": "kibana_sample_data_logs",
        "alias": "my-example-logs"
      }
    }
  ]
}
```
3. Create and use Data View with `my-custom-logs` index pattern

### Checklist

- [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] 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>
Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
2024-10-30 13:35:15 +01:00

69 lines
1.9 KiB
TypeScript

/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
export {
CONTEXT_DEFAULT_SIZE_SETTING,
CONTEXT_STEP_SETTING,
CONTEXT_TIE_BREAKER_FIELDS_SETTING,
DEFAULT_ALLOWED_LOGS_BASE_PATTERNS,
DEFAULT_COLUMNS_SETTING,
DOC_HIDE_TIME_COLUMN_SETTING,
DOC_TABLE_LEGACY,
FIELDS_LIMIT_SETTING,
HIDE_ANNOUNCEMENTS,
MAX_DOC_FIELDS_DISPLAYED,
MODIFY_COLUMNS_ON_SWITCH,
ROW_HEIGHT_OPTION,
SAMPLE_ROWS_PER_PAGE_SETTING,
SAMPLE_SIZE_SETTING,
SEARCH_EMBEDDABLE_TYPE,
SEARCH_FIELDS_FROM_SOURCE,
SEARCH_ON_PAGE_LOAD_SETTING,
SHOW_FIELD_STATISTICS,
SHOW_MULTIFIELDS,
SORT_DEFAULT_ORDER_SETTING,
TRUNCATE_MAX_HEIGHT,
TRUNCATE_MAX_HEIGHT_DEFAULT_VALUE,
IgnoredReason,
buildDataTableRecord,
buildDataTableRecordList,
createLogsContextService,
createDegradedDocsControl,
createStacktraceControl,
fieldConstants,
formatFieldValue,
formatHit,
getDocId,
getLogDocumentOverview,
getIgnoredReason,
getMessageFieldWithFallbacks,
getShouldShowFieldHandler,
isNestedFieldParent,
isLegacyTableEnabled,
usePager,
calcFieldCounts,
getLogLevelColor,
getLogLevelCoalescedValue,
getLogLevelCoalescedValueLabel,
LogLevelCoalescedValue,
getFieldValue,
getVisibleColumns,
canPrependTimeFieldColumn,
DiscoverFlyouts,
AppMenuRegistry,
dismissAllFlyoutsExceptFor,
dismissFlyouts,
LogLevelBadge,
} from './src';
export type { LogsContextService } from './src';
export * from './src/types';
export * from './src/data_types/logs/constants';