kibana/x-pack/plugins/lens/public/datatable_visualization/index.ts

52 lines
1.7 KiB
TypeScript
Raw Normal View History

2020-02-13 13:54:51 +01:00
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
2020-02-13 13:54:51 +01:00
*/
2020-05-15 12:01:27 +02:00
import { CoreSetup } from 'kibana/public';
import { ExpressionsSetup } from '../../../../../src/plugins/expressions/public';
import { EditorFrameSetup, FormatFactory } from '../types';
import { DataPublicPluginStart } from '../../../../../src/plugins/data/public';
2020-02-13 13:54:51 +01:00
interface DatatableVisualizationPluginStartPlugins {
data: DataPublicPluginStart;
}
2020-02-13 13:54:51 +01:00
export interface DatatableVisualizationPluginSetupPlugins {
expressions: ExpressionsSetup;
formatFactory: Promise<FormatFactory>;
2020-02-13 13:54:51 +01:00
editorFrame: EditorFrameSetup;
}
export class DatatableVisualization {
constructor() {}
setup(
core: CoreSetup<DatatableVisualizationPluginStartPlugins, void>,
2020-02-13 13:54:51 +01:00
{ expressions, formatFactory, editorFrame }: DatatableVisualizationPluginSetupPlugins
) {
editorFrame.registerVisualization(async () => {
const {
getDatatable,
2021-02-04 16:22:09 +01:00
datatableColumn,
getDatatableRenderer,
datatableVisualization,
} = await import('../async_services');
const resolvedFormatFactory = await formatFactory;
Row trigger 2 (#83167) * feat: 🎸 add ROW_CLICK_TRIGGER * feat: 🎸 wire row click event to UI Actions trigger in Lens * feat: 🎸 add row click trigger to url drilldown * feat: 🎸 add datatable to row click context * feat: 🎸 pass in row index in row click trigger context * feat: 🎸 add columns to row click trigger context * feat: 🎸 fill values and keys event scope array * feat: 🎸 generate correct row scope variables * fix: 🐛 report triggers from lens embeddable * feat: 🎸 add sample preview for row click trigger * feat: 🎸 remove url drilldown preview box * chore: 🤖 remove mock variable generation functions * feat: 🎸 generate context and global variable lists * feat: 🎸 preview event variable list * feat: 🎸 show empty url error on blur * feat: 🎸 add ability to always show popup for executed actions * refactor: 💡 rename multiple action execution method * fix: 🐛 don't add separator befor group on no main items * feat: 🎸 wire in uiActions service into datatable renderer * feat: 🎸 check each row if it has compatible row click actions * feat: 🎸 allow passing data to expression renderer * feat: 🎸 add isEmbeddable helper * feat: 🎸 pass embeddable to lens table renderer * feat: 🎸 hide lens table row actions which are empty * feat: 🎸 re-render lens embeddable when dynamic actions chagne * feat: 🎸 hide actions column if there are no row actions * feat: 🎸 re-render lens embeddable on view mode chagne * fix: 🐛 fix TypeScript errors * chore: 🤖 fix TypeScript errors * docs: ✏️ update auto-generated docs * feat: 🎸 add hasCompatibleActions to expression layer * feat: 🎸 remove "data" from expression renderer handlers * fix: 🐛 fix TypeScript errors * test: 💍 fix Jest tests * docs: ✏️ update autogenerated docs * fix: 🐛 wrap event payload into data * test: 💍 add "alwaysShowPopup" test * chore: 🤖 add comment requested in review https://github.com/elastic/kibana/pull/83167#discussion_r537340216 * test: 💍 add hasCompatibleActions test * test: 💍 add datatable renderer test * test: 💍 add Lens embeddable input change tests * test: 💍 add embeddable row click test * fix: 🐛 add url validation * test: 💍 add url drilldown tests * docs: ✏️ remove url drilldown preview from docs * docs: ✏️ remove preview from url templating * docs: ✏️ add row click description * chore: 🤖 move 36.5 KB bundle balance to url_drilldown * test: 💍 simplify test case * style: 💄 change types places * refactor: 💡 clean up panel variable generation * test: 💍 add getPanelVariables() tests * fix: 🐛 generate runtime variables correctly * fix: 🐛 improve getVariableList() and add tests for it * feat: 🎸 add translation, improve types
2020-12-14 13:28:23 +01:00
2021-02-04 16:22:09 +01:00
expressions.registerFunction(() => datatableColumn);
expressions.registerFunction(() => getDatatable({ formatFactory: resolvedFormatFactory }));
expressions.registerRenderer(() =>
getDatatableRenderer({
formatFactory: resolvedFormatFactory,
getType: core
.getStartServices()
.then(([_, { data: dataStart }]) => dataStart.search.aggs.types.get),
})
);
return datatableVisualization;
});
2020-02-13 13:54:51 +01:00
}
}