Skip to content
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

[Table Vis] Shim new platform #40732

Merged
merged 12 commits into from
Jul 24, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,27 @@
*/

import { resolve } from 'path';
import { Legacy } from 'kibana';

export default function (kibana) {
import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types';

return new kibana.Plugin({
const tableVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) =>
new Plugin({
id: 'table_vis',
require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter', 'data'],
publicDir: resolve(__dirname, 'public'),
uiExports: {
visTypes: [
'plugins/table_vis/table_vis'
],
interpreter: ['plugins/table_vis/table_vis_fn'],
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
hacks: [resolve(__dirname, 'public/legacy')],
injectDefaultVars: server => ({}),
},
});
init: (server: Legacy.Server) => ({}),
config(Joi: any) {
return Joi.object({
enabled: Joi.boolean().default(true),
}).default();
},
} as Legacy.PluginSpecOptions);

}
// eslint-disable-next-line import/no-default-export
export default tableVisPluginInitializer;
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ import expect from '@kbn/expect';
import ngMock from 'ng_mock';
import { legacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import { VisProvider } from 'ui/vis';
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { AppStateProvider } from 'ui/state_management/app_state';
import { tabifyAggResponse } from 'ui/agg_response/tabify';

describe('Table Vis Controller', function () {
import { createTableVisTypeDefinition } from '../table_vis_type';
import { visualizations } from '../../../visualizations/public';

describe('Table Vis - Controller', async function () {
let $rootScope;
let $compile;
let Private;
Expand All @@ -37,10 +41,20 @@ describe('Table Vis Controller', function () {
let AppState;
let tableAggResponse;
let tabifiedResponse;
let legacyDependencies;

beforeEach(ngMock.module('kibana', 'kibana/table_vis'));
beforeEach(ngMock.inject(function ($injector) {
Private = $injector.get('Private');
legacyDependencies = {
// eslint-disable-next-line new-cap
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization
};

visualizations.types.VisTypesRegistryProvider.register(() =>
createTableVisTypeDefinition(legacyDependencies)
);

$rootScope = $injector.get('$rootScope');
$compile = $injector.get('$compile');
fixtures = require('fixtures/fake_hierarchical_data');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ import { VisProvider } from 'ui/vis';
import { tabifyAggResponse } from 'ui/agg_response/tabify';
import { round } from 'lodash';

describe('AggTable Directive', function () {
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { createTableVisTypeDefinition } from '../../table_vis_type';
import { visualizations } from '../../../../visualizations/public';

describe('Table Vis - AggTable Directive', function () {

let $rootScope;
let $compile;
let Vis;
let indexPattern;
let settings;
let tableAggResponse;
let legacyDependencies;
const tabifiedData = {};

const init = () => {
Expand Down Expand Up @@ -82,6 +87,15 @@ describe('AggTable Directive', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($injector, Private, config) {
legacyDependencies = {
// eslint-disable-next-line new-cap
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization
};

visualizations.types.VisTypesRegistryProvider.register(() =>
createTableVisTypeDefinition(legacyDependencies)
);

tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Vis = Private(VisProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logsta
import { VisProvider } from 'ui/vis';
import { tabifyAggResponse } from 'ui/agg_response/tabify';

describe('AggTableGroup Directive', function () {
import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { createTableVisTypeDefinition } from '../../table_vis_type';
import { visualizations } from '../../../../visualizations/public';

describe('Table Vis - AggTableGroup Directive', function () {
let $rootScope;
let $compile;
let Vis;
let indexPattern;
let tableAggResponse;
let legacyDependencies;
const tabifiedData = {};

const init = () => {
Expand All @@ -56,6 +60,15 @@ describe('AggTableGroup Directive', function () {

beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function ($injector, Private) {
legacyDependencies = {
// eslint-disable-next-line new-cap
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization
};

visualizations.types.VisTypesRegistryProvider.register(() =>
createTableVisTypeDefinition(legacyDependencies)
);

tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Vis = Private(VisProvider);
Expand Down
Loading