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

Migrate vis_type_table to kibana/new platform #63105

Merged
2 changes: 1 addition & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"visDefaultEditor": "src/plugins/vis_default_editor",
"visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown",
"visTypeMetric": "src/legacy/core_plugins/vis_type_metric",
"visTypeTable": "src/legacy/core_plugins/vis_type_table",
"visTypeTable": "src/plugins/vis_type_table",
"visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud",
"visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"],
"visTypeVega": "src/legacy/core_plugins/vis_type_vega",
Expand Down
11 changes: 0 additions & 11 deletions src/legacy/core_plugins/vis_type_table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ const tableVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPl
id: 'table_vis',
require: ['kibana', 'elasticsearch'],
publicDir: resolve(__dirname, 'public'),
uiExports: {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ import moment from 'moment';
import ngMock from 'ng_mock';
import expect from '@kbn/expect';
import sinon from 'sinon';
import { npStart } from '../../legacy_imports';
import './legacy';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { npStart } from 'ui/new_platform';
import { round } from 'lodash';
import { getAngularModule } from '../../get_inner_angular';
import { initTableVisLegacyModule } from '../../table_vis_legacy_module';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInnerAngular } from '../../../../../../plugins/vis_type_table/public/get_inner_angular';

// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { initTableVisLegacyModule } from '../../../../../../plugins/vis_type_table/public/table_vis_legacy_module';
import { tabifiedData } from './tabified_data';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { configureAppAngularModule } from '../../../../../../plugins/kibana_legacy/public/angular';

describe('Table Vis - AggTable Directive', function() {
let $rootScope;
let $compile;
let settings;

const initLocalAngular = () => {
const tableVisModule = getAngularModule('kibana/table_vis', npStart.core);
const tableVisModule = getInnerAngular('kibana/table_vis', npStart.core);
configureAppAngularModule(tableVisModule, npStart.core, true);
initTableVisLegacyModule(tableVisModule);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,24 @@
import $ from 'jquery';
import ngMock from 'ng_mock';
import expect from '@kbn/expect';
import { npStart } from '../../legacy_imports';
import { getAngularModule } from '../../get_inner_angular';
import { initTableVisLegacyModule } from '../../table_vis_legacy_module';
import './legacy';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { getInnerAngular } from '../../../../../../plugins/vis_type_table/public/get_inner_angular';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { initTableVisLegacyModule } from '../../../../../../plugins/vis_type_table/public/table_vis_legacy_module';
import { tabifiedData } from './tabified_data';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { npStart } from 'ui/new_platform';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { configureAppAngularModule } from '../../../../../../plugins/kibana_legacy/public/angular';

describe('Table Vis - AggTableGroup Directive', function() {
let $rootScope;
let $compile;

const initLocalAngular = () => {
const tableVisModule = getAngularModule('kibana/table_vis', npStart.core);
const tableVisModule = getInnerAngular('kibana/table_vis', npStart.core);
configureAppAngularModule(tableVisModule, npStart.core, true);
initTableVisLegacyModule(tableVisModule);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@
* specific language governing permissions and limitations
* under the License.
*/

import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from './legacy_imports';
import { plugin } from '.';

import { TablePluginSetupDependencies } from './plugin';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { npStart, npSetup } from 'ui/new_platform';
import {
TableVisPlugin,
TablePluginSetupDependencies,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../../plugins/vis_type_table/public/plugin';

const plugins: Readonly<TablePluginSetupDependencies> = {
expressions: npSetup.plugins.expressions,
visualizations: npSetup.plugins.visualizations,
};

const pluginInstance = plugin({} as PluginInitializerContext);
const pluginInstance = new TableVisPlugin({} as PluginInitializerContext);

export const setup = pluginInstance.setup(npSetup.core, plugins);
export const start = pluginInstance.start(npStart.core, { data: npStart.plugins.data });
export const start = pluginInstance.start(npStart.core, {
data: npStart.plugins.data,
visualizations: npStart.plugins.visualizations,
});

This file was deleted.

20 changes: 0 additions & 20 deletions src/legacy/core_plugins/vis_type_table/public/legacy_imports.ts

This file was deleted.

This file was deleted.

98 changes: 0 additions & 98 deletions src/legacy/core_plugins/vis_type_table/public/table_vis_type.ts

This file was deleted.

104 changes: 0 additions & 104 deletions src/legacy/core_plugins/vis_type_table/public/vis_controller.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/plugins/kibana_legacy/public/angular/angular_config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ export const configureAppAngularModule = (
) => {
const core = 'core' in newPlatform ? newPlatform.core : newPlatform;
const packageInfo =
'injectedMetadata' in newPlatform
? newPlatform.injectedMetadata.getLegacyMetadata()
: newPlatform.env.packageInfo;
'env' in newPlatform
? newPlatform.env.packageInfo
: newPlatform.injectedMetadata.getLegacyMetadata();

if ('injectedMetadata' in newPlatform) {
forOwn(newPlatform.injectedMetadata.getInjectedVars(), (val, name) => {
Expand Down
11 changes: 11 additions & 0 deletions src/plugins/vis_type_table/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "visTypeTable",
"version": "kibana",
"server": false,
"ui": true,
"requiredPlugins": [
"expressions",
"visualizations",
"data"
]
}
1 change: 1 addition & 0 deletions src/plugins/vis_type_table/public/agg_table/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './agg_table';
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ export function KbnAggTable(config, RecursionHelper) {
}

/**
* @param {[]Object} columns - the formatted columns that will be displayed
* @param {Object[]} columns - the formatted columns that will be displayed
* @param {String} title - the title of the column to add to
* @param {[]Object} rows - the row data for the columns
* @param {Object[]} rows - the row data for the columns
* @param {Number} insertAtIndex - the index to insert the percentage column at
* @returns {Object} - cols and rows for the table to render now included percentage column(s)
*/
Expand Down
Loading